Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SparkleSurvivorsTweaks v1.4.0
plugins/SparkleSurvivorsTweaks.dll
Decompiled 14 hours 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.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Text; using BanditSmokeBombSpeed; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Bandit2; using EntityStates.Bandit2.Weapon; using EntityStates.Barrel; using EntityStates.Captain.Weapon; using EntityStates.CaptainDefenseMatrixItem; using EntityStates.CaptainSupplyDrop; using EntityStates.Commando; using EntityStates.Commando.CommandoWeapon; using EntityStates.Commando.StickyGrenade; using EntityStates.Croco; using EntityStates.Drifter; using EntityStates.Drifter.Bag; using EntityStates.Engi.EngiMissilePainter; using EntityStates.Engi.Mine; using EntityStates.EngiTurret.EngiTurretWeapon; using EntityStates.FalseSon; using EntityStates.Huntress; using EntityStates.Huntress.Cyclone; using EntityStates.Huntress.HuntressWeapon; using EntityStates.Huntress.Weapon; using EntityStates.JunkCube; using EntityStates.Loader; using EntityStates.Mage; using EntityStates.Mage.Weapon; using EntityStates.Merc; using EntityStates.Toolbot; using EntityStates.Treebot.Weapon; using EntityStates.VoidSurvivor.Weapon; using HG; using HarmonyLib; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using SparkleAcolyteTweaks; using SparkleAcridTweaks; using SparkleArtificerTweaks; using SparkleCaptainTweaks; using SparkleChefTweaks; using SparkleCommandoTweaks; using SparkleDrifterTweaks; using SparkleEnforcerTweaks; using SparkleEngineerTweaks; using SparkleFalseSonTweaks; using SparkleHuntressTweaks; using SparkleLoaderTweaks; using SparkleMercTweaks; using SparkleOperatorTweaks; using SparkleRailgunnerTweaks; using SparkleRexTweaks; using SparkleSeekerTweaks; using SparkleSurvivorsTweaks.Shared; using SparkleSurvivorsTweaks.SkillText; using SparkleToolbotTweaks; using SparkleVoidFiendTweaks; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("SparkleSurvivorsTweaks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.5.0")] [assembly: AssemblyInformationalVersion("1.2.5")] [assembly: AssemblyProduct("SparkleSurvivorsTweaks")] [assembly: AssemblyTitle("SparkleSurvivorsTweaks")] [assembly: AssemblyVersion("1.2.5.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 SparkleVoidFiendTweaks { public static class CorruptFormRegen { private const string Section = "VoidFiend"; private const int DiagnosticCount = 5; private const float ScanInterval = 0.5f; private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _penalty; private static ConfigEntry<float> _perLevel; private static ManualLogSource _log; private static int _diagCount; private static float _nextScan; private static readonly Dictionary<CharacterBody, int> _lastVoidItems = new Dictionary<CharacterBody, int>(); public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return true; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "CorruptFormRegenEnabled", true, "腐化形态是否获得负生命恢复。false = 完全保持原版(不扣生命恢复)。"); _penalty = cfg.Bind<float>("VoidFiend", "CorruptFormRegenPenalty", 3f, "腐化形态在 1 级时扣掉多少生命恢复(正数 = 扣多少)。3 = regen -3。运行期读取。"); _perLevel = cfg.Bind<float>("VoidFiend", "CorruptFormRegenPenaltyPerLevel", 0.9f, "腐化形态每提升 1 级,额外再扣多少生命恢复。0.9 = 每级 -0.9。\n最终扣除量 =(基础值 + 这个值 ×(等级 - 1))× (1 + 0.2 × 虚空物品数)。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "腐化形态负生命恢复:按配置关闭,不挂补丁。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(CharacterBody), "RecalculateStats", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "腐化形态负生命恢复补丁失败:取不到 CharacterBody.RecalculateStats。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(CorruptFormRegen), "RecalculateStatsPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:CharacterBody.RecalculateStats <- CorruptFormRegen.RecalculateStatsPostfix(腐化形态负生命恢复)"); } public static string Summary() { if (!IsEnabled) { return "腐化形态负生命恢复:关闭。"; } return "腐化形态负生命恢复:1 级 -" + BasePenalty().ToString("0.##") + ",每级再 -" + PerLevel().ToString("0.##") + ",每件虚空物品最终 +20%。"; } public static void Tick() { if (!IsEnabled || !NetworkServer.active || Time.unscaledTime < _nextScan) { return; } _nextScan = Time.unscaledTime + 0.5f; BuffDef voidSurvivorCorruptMode = Buffs.VoidSurvivorCorruptMode; if ((Object)(object)voidSurvivorCorruptMode == (Object)null) { return; } ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if ((Object)(object)val == (Object)null) { continue; } if (!val.HasBuff(voidSurvivorCorruptMode)) { _lastVoidItems.Remove(val); continue; } int num = VoidItemCount.Count(val); if (_lastVoidItems.TryGetValue(val, out var value) && value != num) { val.RecalculateStats(); } _lastVoidItems[val] = num; } } private static void RecalculateStatsPostfix(CharacterBody __instance) { if ((Object)(object)__instance == (Object)null || !IsEnabled) { return; } BuffDef voidSurvivorCorruptMode = Buffs.VoidSurvivorCorruptMode; if ((Object)(object)voidSurvivorCorruptMode == (Object)null || !__instance.HasBuff(voidSurvivorCorruptMode)) { return; } float num = VoidItemCount.Count(__instance); float num2 = VoidDamage.VoidItemMultiplier(__instance); if (num2 < 0f) { num2 = 0f; } float num3 = PenaltyBeforeVoidItems(__instance) * num2; if (!(num3 <= 0.001f)) { float num4 = ReadRegen(__instance); WriteRegen(__instance, num4 - num3); if (_diagCount < 5) { _diagCount++; Log((LogLevel)16, "腐化形态负生命恢复诊断 #" + _diagCount + ":等级 " + __instance.level.ToString("0") + ",虚空物品 " + num.ToString("0") + ",倍率 " + num2.ToString("0.###") + ",扣除 " + num3.ToString("0.###") + ",regen " + num4.ToString("0.###") + " → " + ReadRegen(__instance).ToString("0.###") + "。"); } } } private static float PenaltyBeforeVoidItems(CharacterBody body) { float num = body.level; if (num < 1f) { num = 1f; } float num2 = BasePenalty() + PerLevel() * (num - 1f); if (!(num2 > 0f)) { return 0f; } return num2; } private static float BasePenalty() { if (_penalty == null) { return 3f; } return Math.Max(0f, _penalty.Value); } private static float PerLevel() { if (_perLevel == null) { return 0.9f; } return Math.Max(0f, _perLevel.Value); } private static float ReadRegen(CharacterBody body) { object obj = RegenField()?.GetValue(body); if (obj == null) { return 0f; } return Convert.ToSingle(obj); } private static void WriteRegen(CharacterBody body, float value) { FieldInfo fieldInfo = RegenField(); if (fieldInfo != null) { fieldInfo.SetValue(body, value); return; } PropertyInfo propertyInfo = AccessTools.Property(typeof(CharacterBody), "regen"); MethodInfo methodInfo = ((propertyInfo != null) ? propertyInfo.GetSetMethod(nonPublic: true) : null); if (methodInfo != null) { methodInfo.Invoke(body, new object[1] { value }); } else { Log((LogLevel)4, "腐化形态负生命恢复:写不进 CharacterBody.regen,这一项没生效。"); } } private static FieldInfo RegenField() { return AccessTools.Field(typeof(CharacterBody), "<regen>k__BackingField"); } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptionExitInvincibility { private const string Section = "VoidFiend"; private const float DefaultDuration = 0.5f; private const int DiagnosticCount = 5; private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _duration; private static ManualLogSource _log; private static int _applyCount; private static int _diagCount; private static bool _vanillaLogged; private static readonly Type ExitType = AccessTools.TypeByName("EntityStates.VoidSurvivor.ExitCorruptionTransition"); private static readonly Type EnterType = AccessTools.TypeByName("EntityStates.VoidSurvivor.EnterCorruptionTransition"); private static readonly FieldInfo LingeringField = ((EnterType != null) ? AccessTools.Field(EnterType, "lingeringInvincibilityDuration") : null); private static readonly MethodInfo CharacterBodyGetter = AccessTools.PropertyGetter(typeof(EntityState), "characterBody"); public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return true; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "CorruptionExitInvincibilityEnabled", true, "从腐化状态退出时是否获得一段无敌(和进入腐化时那类无敌一样)。"); _duration = cfg.Bind<float>("VoidFiend", "CorruptionExitInvincibilityDuration", 0.5f, "退出腐化后的无敌持续多少秒。原版进入腐化时用的是 0.5 秒,这里默认跟它一致。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "退出腐化无敌:按配置保持原版。"); return; } Type type = AccessTools.TypeByName("EntityStates.VoidSurvivor.CorruptionTransitionBase"); if (type == null) { Log((LogLevel)2, "退出腐化无敌补丁失败:取不到 CorruptionTransitionBase。"); return; } if (ExitType == null) { Log((LogLevel)2, "退出腐化无敌补丁失败:取不到 ExitCorruptionTransition。"); return; } MethodInfo methodInfo = AccessTools.Method(type, "OnExit", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "退出腐化无敌补丁失败:取不到 CorruptionTransitionBase.OnExit。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(CorruptionExitInvincibility), "OnExitPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:VoidSurvivor.CorruptionTransitionBase.OnExit <- OnExitPostfix(退出腐化后 " + Duration().ToString("0.##") + " 秒无敌)" + VanillaNote()); } public static string Summary() { if (!IsEnabled) { return ""; } return " [退出腐化:" + Duration().ToString("0.##") + "s无敌]"; } private static void OnExitPostfix(object __instance) { if (!IsEnabled || __instance == null || __instance.GetType() != ExitType || !NetworkServer.active) { return; } CharacterBody val = (CharacterBody)((CharacterBodyGetter != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null) { return; } float num = Duration(); if (!(num <= 0f)) { val.AddTimedBuff(Buffs.HiddenInvincibility, num); _applyCount++; if (_diagCount < 5) { _diagCount++; Log((LogLevel)16, "退出腐化无敌 #" + _diagCount + ":已给 " + ((Object)val).name + " 挂 " + num.ToString("0.##") + " 秒 HiddenInvincibility(累计 " + _applyCount + " 次)。"); } } } private static float Duration() { if (_duration == null) { return 0.5f; } return _duration.Value; } private static string VanillaNote() { if (LingeringField == null) { return ""; } try { float num = Convert.ToSingle(LingeringField.GetValue(null)); if (!_vanillaLogged) { _vanillaLogged = true; Log((LogLevel)16, "退出腐化无敌:原版进入腐化时的残留无敌是 " + num.ToString("0.##") + " 秒。"); } return "(原版进入腐化 " + num.ToString("0.##") + "s)"; } catch (Exception) { return ""; } } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptionMinimum { private const string Section = "VoidFiend"; private const int DiagnosticCount = 3; private const float ScanInterval = 0.5f; private static readonly FieldInfo PerVoidItemField = AccessTools.Field(typeof(VoidSurvivorController), "minimumCorruptionPerVoidItem"); private static ConfigEntry<bool> _enabled; private static ManualLogSource _log; private static float _scanTimer; private static int _diagCount; public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return true; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "DisableVoidItemMinimumCorruption", true, "是否让虚空物品不再提升腐化值下限。true = 下限恒为 0(原版每件约 +2%);false = 保持原版。"); if (PerVoidItemField == null) { Log((LogLevel)2, "腐化值下限补丁失败:取不到 VoidSurvivorController.minimumCorruptionPerVoidItem。"); } } public static string Summary() { if (!IsEnabled) { return "腐化值下限:保持原版(每件虚空物品约 +2%)。"; } return "腐化值下限:虚空物品不再提升,恒为 0。"; } public static void Tick() { if (!IsEnabled || PerVoidItemField == null) { return; } _scanTimer -= Time.deltaTime; if (_scanTimer > 0f) { return; } _scanTimer = 0.5f; ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if ((Object)(object)val == (Object)null) { continue; } VoidSurvivorController component = ((Component)val).GetComponent<VoidSurvivorController>(); if ((Object)(object)component == (Object)null) { continue; } try { float num = Convert.ToSingle(PerVoidItemField.GetValue(component)); if (num != 0f) { PerVoidItemField.SetValue(component, 0f); if (_diagCount < 3) { _diagCount++; Log((LogLevel)16, "腐化值下限诊断 #" + _diagCount + ":每件 " + num.ToString("0.###") + " → 0," + ((Object)val).name + " 当前下限 " + component.minimumCorruption.ToString("0.##") + "。"); } } } catch (Exception ex) { Log((LogLevel)4, "腐化值下限改写异常(已忽略)—— " + ex.GetType().Name + " " + ex.Message); } } } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptModeStats { private const string Section = "VoidFiend"; private const int DiagnosticCount = 5; private const float VanillaArmor = 100f; private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _armor; private static ConfigEntry<float> _attackSpeedPercent; private static ConfigEntry<float> _moveSpeedPercent; private static ManualLogSource _log; private static int _applyCount; private static int _diagCount; public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return false; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "CorruptModeStatsEnabled", true, "是否调整「虚空幸存者腐化模式」buff 提供的属性。false = 完全保持原版。"); _armor = cfg.Bind<float>("VoidFiend", "CorruptModeArmor", 200f, "腐化模式下这个 buff 提供的护甲总量。原版是 100,这里补差额到 200。运行期读取。"); _attackSpeedPercent = cfg.Bind<float>("VoidFiend", "CorruptModeAttackSpeedPercent", 30f, "腐化模式下提供的攻击速度加成(百分比)。30 = 总攻速 ×1.30。\n原版没有这一项,是纯新增。运行期读取。"); _moveSpeedPercent = cfg.Bind<float>("VoidFiend", "CorruptModeMoveSpeedPercent", 30f, "腐化模式下提供的移动速度加成(百分比)。30 = 总移速 ×1.30。\n原版没有这一项,是纯新增。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "腐化模式属性:按配置保持原版,不挂补丁。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(CharacterBody), "RecalculateStats", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "腐化模式属性补丁失败:取不到 CharacterBody.RecalculateStats。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(CorruptModeStats), "RecalculateStatsPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:CharacterBody.RecalculateStats <- RecalculateStatsPostfix(腐化模式属性)"); } public static string Summary() { return "腐化模式属性:护甲 " + ArmorValue().ToString("0") + ",攻速 +" + AttackSpeedPercent().ToString("0.#") + "%,移速 +" + MoveSpeedPercent().ToString("0.#") + "%。"; } private static void RecalculateStatsPostfix(CharacterBody __instance) { if ((Object)(object)__instance == (Object)null || !IsEnabled) { return; } BuffDef voidSurvivorCorruptMode = Buffs.VoidSurvivorCorruptMode; if (!((Object)(object)voidSurvivorCorruptMode == (Object)null) && __instance.HasBuff(voidSurvivorCorruptMode)) { float num = ArmorValue() - 100f; if (Math.Abs(num) > 0.001f) { AddStat(__instance, "armor", num); } float num2 = 1f + AttackSpeedPercent() * 0.01f; if (Math.Abs(num2 - 1f) > 0.0001f) { ScaleStat(__instance, "attackSpeed", num2); } float num3 = 1f + MoveSpeedPercent() * 0.01f; if (Math.Abs(num3 - 1f) > 0.0001f) { ScaleStat(__instance, "moveSpeed", num3); } _applyCount++; if (_diagCount < 5) { _diagCount++; Log((LogLevel)16, "腐化模式属性诊断 #" + _diagCount + ":等级 " + __instance.level.ToString("0") + ",护甲 " + ReadStat(__instance, "armor").ToString("0.#") + "(原版 100 + 补 " + num.ToString("0.#") + "),攻速 " + ReadStat(__instance, "attackSpeed").ToString("0.###") + ",移速 " + ReadStat(__instance, "moveSpeed").ToString("0.###") + "。"); } } } private static float ArmorValue() { if (_armor == null) { return 100f; } return _armor.Value; } private static float AttackSpeedPercent() { if (_attackSpeedPercent == null) { return 0f; } return _attackSpeedPercent.Value; } private static float MoveSpeedPercent() { if (_moveSpeedPercent == null) { return 0f; } return _moveSpeedPercent.Value; } private static void AddStat(CharacterBody body, string name, float delta) { WriteStat(body, name, ReadStat(body, name) + delta); } private static void ScaleStat(CharacterBody body, string name, float factor) { WriteStat(body, name, ReadStat(body, name) * factor); } private static float ReadStat(CharacterBody body, string name) { FieldInfo fieldInfo = AccessTools.Field(typeof(CharacterBody), "<" + name + ">k__BackingField"); if (fieldInfo != null) { return (float)fieldInfo.GetValue(body); } PropertyInfo propertyInfo = AccessTools.Property(typeof(CharacterBody), name); if (propertyInfo != null) { MethodInfo getMethod = propertyInfo.GetGetMethod(nonPublic: true); if (getMethod != null) { return (float)getMethod.Invoke(body, null); } } Log((LogLevel)4, "腐化模式属性:读不到 CharacterBody." + name + ",按 0 处理。"); return 0f; } private static void WriteStat(CharacterBody body, string name, float value) { FieldInfo fieldInfo = AccessTools.Field(typeof(CharacterBody), "<" + name + ">k__BackingField"); if (fieldInfo != null) { fieldInfo.SetValue(body, value); return; } PropertyInfo propertyInfo = AccessTools.Property(typeof(CharacterBody), name); if (propertyInfo != null) { MethodInfo setMethod = propertyInfo.GetSetMethod(nonPublic: true); if (setMethod != null) { setMethod.Invoke(body, new object[1] { value }); return; } } Log((LogLevel)4, "腐化模式属性:写不进 CharacterBody." + name + ",这一项没生效。"); } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptPrimaryTweaks { private const string Section = "VoidFiend"; private const int DiagnosticCount = 5; private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _tickRate; private static ConfigEntry<float> _damagePerTick; private static ConfigEntry<float> _procPerTick; private static ConfigEntry<bool> _gradientColor; private static ConfigEntry<bool> _critNumberStyle; private static ManualLogSource _log; private static int _diagCount; private static readonly FieldInfo DamageNumberPsField = AccessTools.Field(typeof(DamageNumberManager), "ps"); private static readonly FieldInfo DamageNumberCustomDataField = AccessTools.Field(typeof(DamageNumberManager), "customData"); private static readonly Color32 DamageNumberBright = new Color32(byte.MaxValue, (byte)121, (byte)197, byte.MaxValue); private static readonly Color32 DamageNumberRose = new Color32(byte.MaxValue, (byte)96, (byte)190, byte.MaxValue); private static readonly Color32 DamageNumberHot = new Color32((byte)224, (byte)80, (byte)160, byte.MaxValue); private static readonly Color32 DamageNumberMagenta = new Color32((byte)208, (byte)80, (byte)192, byte.MaxValue); private const int DamageNumberSteps = 6; private static int _numberDiagCount; private static int _numberColorStep; private static readonly FieldInfo TickRateField = AccessTools.Field(typeof(FireCorruptHandBeam), "tickRate"); private static readonly FieldInfo DamagePerSecondField = AccessTools.Field(typeof(FireCorruptHandBeam), "damageCoefficientPerSecond"); private static readonly FieldInfo ProcPerSecondField = AccessTools.Field(typeof(FireCorruptHandBeam), "procCoefficientPerSecond"); private static readonly FieldInfo AttackSpeedStatField = AccessTools.Field(typeof(BaseState), "attackSpeedStat"); private static GameObject _armedOwner; public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return false; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "CorruptPrimaryEnabled", true, "是否调整腐化形态 M1「溺亡」的攻击间隔与单次伤害。"); _tickRate = cfg.Bind<float>("VoidFiend", "CorruptPrimaryTickRate", 8f, "腐化 M1 每秒攻击次数。原版 8(间隔 0.125 秒),本模组默认也保持 8。\n实际间隔还会除以攻击速度。"); _damagePerTick = cfg.Bind<float>("VoidFiend", "CorruptPrimaryDamagePerTick", 2.5f, "腐化 M1 单次命中的伤害倍率,这一整发都是「虚无」伤害。\n原版 2.5(250%),默认 2.5;每秒 8 次即 2000%/秒。"); _procPerTick = cfg.Bind<float>("VoidFiend", "CorruptPrimaryProcCoefficientPerTick", 0.75f, "腐化 M1 单次命中的触发系数(proc coefficient)。\n原版 0.625;默认 0.75。虚无伤害不会绕过 proc 结算。"); _critNumberStyle = cfg.Bind<bool>("VoidFiend", "CorruptPrimaryVoidDamageNumberCritStyle", true, "「虚无」伤害的伤害数字是否一律使用暴击样式(字号更大、带暴击描边)。\n关掉后非暴击的虚无伤害就是普通字号。"); _gradientColor = cfg.Bind<bool>("VoidFiend", "CorruptPrimaryVoidDamageGradientColor", true, "「虚无」伤害的伤害数字是否改用「失落先知的透镜」处决数字的配色(亮粉 → 粉紫的渐变流动)。关闭则沿用原版虚空紫。"); } public static string Summary() { if (!IsEnabled) { return "腐化 M1:保持原版。"; } return "腐化 M1:间隔 " + (1f / TickRateValue()).ToString("0.###") + " 秒、单次 " + (DamagePerTickValue() * 100f).ToString("0.#") + "% 虚无伤害、触发系数 " + ProcPerTickValue().ToString("0.###") + "。"; } public static void Patch(Harmony harmony) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_011f: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "腐化 M1:按配置保持原版,不挂补丁。"); return; } if (TickRateField == null || DamagePerSecondField == null || ProcPerSecondField == null) { Log((LogLevel)2, "腐化 M1 补丁失败:取不到 FireCorruptHandBeam 的 tickRate / damageCoefficientPerSecond / procCoefficientPerSecond 字段。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(FireCorruptHandBeam), "OnEnter", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(FireCorruptHandBeam), "FireBullet", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(BulletAttack), "Fire", new Type[0], (Type[])null); if (methodInfo == null || methodInfo2 == null || methodInfo3 == null) { Log((LogLevel)2, "腐化 M1 补丁失败:取不到 OnEnter / FireBullet / BulletAttack.Fire。"); return; } harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(CorruptPrimaryTweaks), "OnEnterPrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(AccessTools.Method(typeof(CorruptPrimaryTweaks), "FireBulletPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(CorruptPrimaryTweaks), "FireBulletPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(AccessTools.Method(typeof(CorruptPrimaryTweaks), "BulletFirePrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:BulletAttack.Fire <- CorruptPrimaryTweaks.BulletFirePrefix(腐化 M1 转虚无伤害)"); if (_gradientColor != null && _gradientColor.Value && DamageNumberPsField != null && DamageNumberCustomDataField != null) { MethodInfo methodInfo4 = AccessTools.Method(typeof(DamageNumberManager), "SpawnDamageNumber", (Type[])null, (Type[])null); if (methodInfo4 != null) { harmony.Patch((MethodBase)methodInfo4, new HarmonyMethod(AccessTools.Method(typeof(CorruptPrimaryTweaks), "SpawnDamageNumberPrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:DamageNumberManager.SpawnDamageNumber(虚无伤害数字改为透镜处决配色)"); } } Log((LogLevel)16, "补丁已挂载:FireCorruptHandBeam.OnEnter / FireBullet(腐化 M1 攻击间隔与伤害)"); } private static void OnEnterPrefix(FireCorruptHandBeam __instance) { if (__instance == null || !IsEnabled) { return; } ApplyTuning(__instance); if (_diagCount < 5) { _diagCount++; float num = ((AttackSpeedStatField != null) ? ((float)AttackSpeedStatField.GetValue(__instance)) : 1f); if (num < 0.0001f) { num = 1f; } Log((LogLevel)16, "腐化 M1 诊断 #" + _diagCount + ":tickRate " + TickRateValue().ToString("0.###") + ",单次倍率 " + (DamagePerTickValue() * 100f).ToString("0.#") + "%,单次触发系数 " + ProcPerTickValue().ToString("0.###") + ",攻击速度 " + num.ToString("0.###") + ",实际间隔 " + (1f / TickRateValue() / num).ToString("0.###") + " 秒。"); } } private static void ApplyTuning(FireCorruptHandBeam state) { float num = TickRateValue(); TickRateField.SetValue(state, num); DamagePerSecondField.SetValue(state, DamagePerTickValue() * num); ProcPerSecondField.SetValue(state, ProcPerTickValue() * num); } private static void FireBulletPrefix(FireCorruptHandBeam __instance) { if (__instance != null && IsEnabled) { ApplyTuning(__instance); _armedOwner = (((Object)(object)((EntityState)__instance).outer != (Object)null) ? ((Component)((EntityState)__instance).outer).gameObject : null); } } private static void FireBulletPostfix() { _armedOwner = null; } private static void BulletFirePrefix(BulletAttack __instance) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (__instance == null || (Object)(object)_armedOwner == (Object)null || __instance.owner != _armedOwner) { return; } _armedOwner = null; ModifyOutgoingDamageCallback previous = __instance.modifyOutgoingDamageCallback; __instance.modifyOutgoingDamageCallback = (ModifyOutgoingDamageCallback)delegate(BulletAttack attack, ref BulletHit hit, DamageInfo damageInfo) { if (previous != null) { previous.Invoke(attack, ref hit, damageInfo); } VoidDamage.Mark(damageInfo, attack?.owner); }; } private static bool SpawnDamageNumberPrefix(DamageNumberManager __instance, float amount, Vector3 position, bool crit, TeamIndex teamIndex, DamageColorIndex __4) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (_gradientColor == null || !_gradientColor.Value) { return true; } if ((int)__4 != 9) { return true; } ParticleSystem val = (ParticleSystem)((DamageNumberPsField != null) ? /*isinst with value type is only supported in some contexts*/: null); List<Vector4> list = ((DamageNumberCustomDataField != null) ? (DamageNumberCustomDataField.GetValue(__instance) as List<Vector4>) : null); if ((Object)(object)val == (Object)null || list == null) { return true; } Color32 startColor = CurrentGradientColor(); _numberColorStep++; EmitParams val2 = default(EmitParams); ((EmitParams)(ref val2)).position = position; ((EmitParams)(ref val2)).startColor = startColor; ((EmitParams)(ref val2)).applyShapeToPosition = true; val.Emit(val2, 1); val.GetCustomParticleData(list, (ParticleSystemCustomData)0); if (list.Count > 0) { list[list.Count - 1] = new Vector4(1f, 0f, amount, (_critNumberStyle != null && _critNumberStyle.Value) ? 1f : (crit ? 1f : 0f)); val.SetCustomParticleData(list, (ParticleSystemCustomData)0); } if (_numberDiagCount < 5) { _numberDiagCount++; Log((LogLevel)16, "虚无伤害数字 #" + _numberDiagCount + ":写入 (" + startColor.r + "," + startColor.g + "," + startColor.b + "),数值 " + amount.ToString("0.##")); } return false; } private static Color32 CurrentGradientColor() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Abs(_numberColorStep % 10); int num2 = 5; float num3 = (float)((num <= num2) ? num : (10 - num)) / (float)num2 * 3f; if (num3 < 1f) { return Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(DamageNumberBright), Color32.op_Implicit(DamageNumberRose), num3)); } if (num3 < 2f) { return Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(DamageNumberRose), Color32.op_Implicit(DamageNumberHot), num3 - 1f)); } return Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(DamageNumberHot), Color32.op_Implicit(DamageNumberMagenta), num3 - 2f)); } private static float TickRateValue() { float num = ((_tickRate != null) ? _tickRate.Value : 8f); if (!(num > 0.01f)) { return 8f; } return num; } private static float DamagePerTickValue() { float num = ((_damagePerTick != null) ? _damagePerTick.Value : 2.5f); if (!(num > 0f)) { return 2.5f; } return num; } private static float ProcPerTickValue() { float num = ((_procPerTick != null) ? _procPerTick.Value : 0.75f); if (!(num >= 0f)) { return 0.75f; } return num; } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptSecondaryTweaks { private const string Section = "VoidFiend"; private const int DiagnosticCount = 5; private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _coefficient; private static ConfigEntry<float> _vanillaCoefficient; private static ConfigEntry<string> _projectileName; private static ManualLogSource _log; private static int _diagCount; public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return false; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "CorruptSecondaryEnabled", true, "是否调整腐化形态 M2「腐化流」的伤害倍率并转成「虚无」伤害。\nfalse = 保持原版 1100% 普通伤害。运行期读取。"); _coefficient = cfg.Bind<float>("VoidFiend", "CorruptSecondaryDamageCoefficient", 16f, "腐化 M2 的目标伤害倍率。16 = 1600%(原版 11 = 1100%)。运行期读取。"); _vanillaCoefficient = cfg.Bind<float>("VoidFiend", "CorruptSecondaryVanillaDamageCoefficient", 11f, "腐化 M2 原版的伤害倍率,用来换算缩放比例。11 = 1100%。\n实际乘数 = CorruptSecondaryDamageCoefficient / 这个值。运行期读取。"); _projectileName = cfg.Bind<string>("VoidFiend", "CorruptSecondaryProjectileName", "VoidSurvivorMegaBlaster", "腐化 M2 射弹预制体名(包含匹配,大小写不敏感),还必须含 Corrupted。\n清空 = 关闭识别。运行期读取。"); } public static string Summary() { if (!IsEnabled) { return "腐化 M2:保持原版。"; } return "腐化 M2:" + (CoefficientValue() * 100f).ToString("0.#") + "% 虚无伤害(缩放 ×" + RatioValue().ToString("0.###") + ")。"; } public static void Patch(Harmony harmony) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "腐化 M2:按配置保持原版,不挂补丁。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(ProjectileManager), "InitializeProjectile", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "腐化 M2 补丁失败:取不到 ProjectileManager.InitializeProjectile。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(CorruptSecondaryTweaks), "InitializeProjectilePostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:ProjectileManager.InitializeProjectile <- CorruptSecondaryTweaks.InitializeProjectilePostfix(腐化 M2 虚无伤害)"); } public static void InitializeProjectilePostfix(ProjectileController projectileController, FireProjectileInfo fireProjectileInfo) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!IsEnabled || (Object)(object)projectileController == (Object)null) { return; } GameObject projectilePrefab = fireProjectileInfo.projectilePrefab; if ((Object)(object)projectilePrefab == (Object)null || !IsTarget(((Object)projectilePrefab).name)) { return; } ProjectileDamage component = ((Component)projectileController).GetComponent<ProjectileDamage>(); if (!((Object)(object)component == (Object)null)) { float num = RatioValue(); float damage = component.damage; component.damage *= num; component.damageType = VoidDamage.MarkCombo(component.damageType); component.damageColorIndex = (DamageColorIndex)9; if (_diagCount < 5) { _diagCount++; Log((LogLevel)16, "腐化 M2 诊断 #" + _diagCount + ":「" + ((Object)projectilePrefab).name + "」伤害 " + damage.ToString("0.##") + " → " + component.damage.ToString("0.##") + "(×" + num.ToString("0.###") + "),已标记虚无。"); } } } private static bool IsTarget(string prefabName) { string value = ((_projectileName != null) ? _projectileName.Value : null); if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(prefabName)) { return false; } if (prefabName.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return prefabName.IndexOf("Corrupted", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } private static float CoefficientValue() { float num = ((_coefficient != null) ? _coefficient.Value : 16f); if (!(num > 0f)) { return 16f; } return num; } private static float VanillaCoefficientValue() { float num = ((_vanillaCoefficient != null) ? _vanillaCoefficient.Value : 11f); if (!(num > 0.01f)) { return 11f; } return num; } private static float RatioValue() { return CoefficientValue() / VanillaCoefficientValue(); } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptSuppressStock { private sealed class StockState { public int VoidItems; public int Desired; } private const string Section = "VoidFiend"; private const int DiagnosticCount = 6; private const float ScanInterval = 0.25f; private static readonly MethodInfo OverrideMaxStockMethod = AccessTools.Method(typeof(GenericSkill), "OverrideMaxStock", (Type[])null, (Type[])null); private static readonly FieldInfo SkillDefField = AccessTools.Field(typeof(GenericSkill), "<skillDef>k__BackingField"); private static readonly FieldInfo BaseMaxStockField = AccessTools.Field(typeof(SkillDef), "baseMaxStock"); private static readonly MethodInfo BodyGetter = AccessTools.Method(typeof(EntityState), "get_characterBody", (Type[])null, (Type[])null); private static readonly Type CorruptModeType = AccessTools.TypeByName("EntityStates.VoidSurvivor.CorruptMode.CorruptMode"); private static ConfigEntry<bool> _enabled; private static ManualLogSource _log; private static int _diagCount; private static float _nextScan; private static readonly Dictionary<CharacterBody, StockState> _states = new Dictionary<CharacterBody, StockState>(); public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return true; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "SuppressVoidItemStockEnabled", true, "腐化形态「抑制」的初始充能层数是否随虚空物品增加。每 1 个虚空物品 +1 层。\nfalse = 充能层数完全保持原版。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "抑制初始充能:按配置保持原版,不挂补丁。"); return; } if (OverrideMaxStockMethod == null || SkillDefField == null || BaseMaxStockField == null) { Log((LogLevel)2, "抑制初始充能补丁失败:取不到 GenericSkill.OverrideMaxStock / skillDef / SkillDef.baseMaxStock。"); return; } MethodInfo methodInfo = ((CorruptModeType != null) ? AccessTools.Method(CorruptModeType, "OnEnter", (Type[])null, (Type[])null) : null); if (methodInfo == null) { Log((LogLevel)2, "抑制初始充能补丁失败:取不到 CorruptMode.OnEnter。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(CorruptSuppressStock), "CorruptOnEnterPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:VoidSurvivor.CorruptMode.OnEnter <- CorruptOnEnterPostfix(抑制初始充能 = 基础层数 + 虚空物品数)"); } public static string Summary() { if (!IsEnabled) { return "抑制初始充能:保持原版。"; } return "抑制初始充能:基础层数 + 每件虚空物品 1 层,进入腐化形态时补满。"; } private static void CorruptOnEnterPostfix(object __instance) { if (IsEnabled && NetworkServer.active) { CharacterBody val = ResolveBody(__instance); if ((Object)(object)val != (Object)null) { Apply(val, initial: true); } } } public static void Tick() { if (!IsEnabled || !NetworkServer.active || Time.unscaledTime < _nextScan) { return; } _nextScan = Time.unscaledTime + 0.25f; BuffDef voidSurvivorCorruptMode = Buffs.VoidSurvivorCorruptMode; if ((Object)(object)voidSurvivorCorruptMode == (Object)null) { return; } ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if (!((Object)(object)val == (Object)null)) { if (val.HasBuff(voidSurvivorCorruptMode)) { Apply(val, initial: false); } else { _states.Remove(val); } } } } private static void Apply(CharacterBody body, bool initial) { if ((Object)(object)body == (Object)null || !IsEnabled || OverrideMaxStockMethod == null) { return; } GenericSkill val = (((Object)(object)body.skillLocator != (Object)null) ? body.skillLocator.special : null); if ((Object)(object)val == (Object)null) { return; } int num = VoidItemCount.Count(body); int num2 = ReadBaseStock(val); int num3 = num2 + num; if (num3 < 1) { num3 = 1; } StockState value; bool flag = _states.TryGetValue(body, out value); if (!flag) { value = new StockState(); _states.Add(body, value); } int desired = value.Desired; try { if (val.maxStock != num3) { OverrideMaxStockMethod.Invoke(val, new object[1] { num3 }); } if (initial || !flag) { val.stock = num3; } else if (num3 > desired) { int num4 = num3 - desired; val.stock = Math.Min(num3, Math.Max(0, val.stock) + num4); } else if (val.stock > num3) { val.stock = num3; } } catch (Exception ex) { Log((LogLevel)4, "抑制初始充能应用失败(已忽略)—— " + ex.GetType().Name + " " + ex.Message); return; } value.VoidItems = num; value.Desired = num3; if (_diagCount < 6) { _diagCount++; Log((LogLevel)16, "抑制充能诊断 #" + _diagCount + ":基础 " + num2 + " 层 + 虚空物品 " + num + " 件 -> maxStock " + val.maxStock + ",当前 stock " + val.stock + "。"); } } private static int ReadBaseStock(GenericSkill special) { object obj = ((SkillDefField != null) ? SkillDefField.GetValue(special) : null); if (obj == null || BaseMaxStockField == null) { return 2; } object value = BaseMaxStockField.GetValue(obj); int num = ((value != null) ? Convert.ToInt32(value) : 2); if (num <= 0) { return 1; } return num; } private static CharacterBody ResolveBody(object state) { if (BodyGetter != null) { object? obj = BodyGetter.Invoke(state, null); CharacterBody val = (CharacterBody)((obj is CharacterBody) ? obj : null); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class CorruptSuppressTweaks { private sealed class CrushState { public object Instance; public float SelfHealFraction; public float CorruptionChange; public float CorruptionChangeApplied; public float HealFraction; public int TotalStock; public int Used; public bool IsLast; } private const string Section = "VoidFiend"; private const int DiagnosticCount = 6; private const int FallbackBaseStock = 2; private static readonly Type CrushBaseType = AccessTools.TypeByName("EntityStates.VoidSurvivor.Weapon.CrushBase"); private static readonly FieldInfo SelfHealFractionField = ((CrushBaseType != null) ? AccessTools.Field(CrushBaseType, "selfHealFraction") : null); private static readonly FieldInfo CorruptionChangeField = ((CrushBaseType != null) ? AccessTools.Field(CrushBaseType, "corruptionChange") : null); private static readonly MethodInfo BodyGetter = AccessTools.Method(typeof(EntityState), "get_characterBody", (Type[])null, (Type[])null); private static readonly MethodInfo HealthGetter = AccessTools.Method(typeof(EntityState), "get_healthComponent", (Type[])null, (Type[])null); private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _totalHealPercent; private static ManualLogSource _log; private static int _diagCount; private static readonly Dictionary<CharacterBody, int> _useCount = new Dictionary<CharacterBody, int>(); public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return true; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "SuppressReworkEnabled", true, "是否重做腐化形态 R「抑制」。false = 完全保持原版(扣血换腐化)。"); _totalHealPercent = cfg.Bind<float>("VoidFiend", "SuppressTotalHealPercent", 50f, "抑制全部充能层数用完后,总共治疗最大生命值的百分比。50 = 50%。\n每次治疗量 = 这个值 / 初始充能层数。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00ae: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "抑制重做:按配置保持原版,不挂补丁。"); return; } if (CrushBaseType == null || SelfHealFractionField == null || CorruptionChangeField == null) { Log((LogLevel)2, "抑制重做补丁失败:取不到 CrushBase 的字段(selfHealFraction / corruptionChange)。"); return; } MethodInfo methodInfo = AccessTools.Method(CrushBaseType, "OnEnter", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "抑制重做补丁失败:取不到 CrushBase.OnEnter。"); return; } harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(CorruptSuppressTweaks), "CrushOnEnterPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(CorruptSuppressTweaks), "CrushOnEnterPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:VoidSurvivor.Weapon.CrushBase.OnEnter <- CrushOnEnterPrefix/Postfix(抑制:纯治疗,前几次不动腐化值,最后一次清空并退形态)"); } public static string Summary() { if (!IsEnabled) { return "抑制(腐化):保持原版。"; } return "抑制(腐化):不再自伤;总治疗 " + TotalHealPercent().ToString("0.#") + "% 按初始充能层数均分;前几次不减腐化值,最后一次才清空并退出形态。"; } public static void Tick() { if (_useCount.Count == 0) { return; } BuffDef voidSurvivorCorruptMode = Buffs.VoidSurvivorCorruptMode; List<CharacterBody> list = new List<CharacterBody>(); foreach (KeyValuePair<CharacterBody, int> item in _useCount) { CharacterBody key = item.Key; if ((Object)(object)key == (Object)null || ((Object)(object)voidSurvivorCorruptMode != (Object)null && !key.HasBuff(voidSurvivorCorruptMode))) { list.Add(key); } } for (int i = 0; i < list.Count; i++) { _useCount.Remove(list[i]); } } private static void CrushOnEnterPrefix(object __instance, out CrushState __state) { __state = null; if (!IsEnabled || __instance == null || SelfHealFractionField == null || CorruptionChangeField == null) { return; } try { float num = Convert.ToSingle(SelfHealFractionField.GetValue(__instance)); if (num >= 0f) { return; } CharacterBody val = ResolveBody(__instance); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.healthComponent == (Object)null)) { GenericSkill val2 = (((Object)(object)val.skillLocator != (Object)null) ? val.skillLocator.special : null); int num2 = TotalStock(val2, val); float num3 = TotalHealPercent() * 0.01f / (float)num2; float corruptionChange = Convert.ToSingle(CorruptionChangeField.GetValue(__instance)); _useCount.TryGetValue(val, out var value); value++; bool flag = ((Object)(object)val2 != (Object)null && val2.stock <= 0) || value >= num2; float num4 = (flag ? (-1000000f) : 0f); CrushState crushState = new CrushState(); crushState.Instance = __instance; crushState.SelfHealFraction = num; crushState.CorruptionChange = corruptionChange; crushState.TotalStock = num2; crushState.HealFraction = num3; crushState.CorruptionChangeApplied = num4; crushState.Used = value; crushState.IsLast = flag; SelfHealFractionField.SetValue(__instance, num3); CorruptionChangeField.SetValue(__instance, num4); if (flag) { _useCount.Remove(val); VoidSelfDamage.ForceExitCorruptMode(val); } else { _useCount[val] = value; } __state = crushState; if (_diagCount < 6) { _diagCount++; Log((LogLevel)16, "抑制重做诊断 #" + _diagCount + ":初始 " + num2 + " 层,第 " + value + " 次使用,本次治疗 " + (num3 * 100f).ToString("0.##") + "%(总 " + TotalHealPercent().ToString("0.#") + "%),腐化值变化 " + num4.ToString("0.##") + ",最后一次=" + flag + "。"); } } } catch (Exception ex) { Log((LogLevel)4, "抑制重做 Prefix 异常(已忽略)—— " + ex.GetType().Name + " " + ex.Message); } } private static void CrushOnEnterPostfix(CrushState __state) { if (__state == null || __state.Instance == null) { return; } try { SelfHealFractionField.SetValue(__state.Instance, __state.SelfHealFraction); CorruptionChangeField.SetValue(__state.Instance, __state.CorruptionChange); } catch (Exception ex) { Log((LogLevel)4, "抑制重做 Postfix 异常(已忽略)—— " + ex.GetType().Name + " " + ex.Message); } } private static int TotalStock(GenericSkill special, CharacterBody body) { if ((Object)(object)special != (Object)null && special.maxStock > 0) { return special.maxStock; } int num = 2 + VoidItemCount.Count(body); if (num <= 0) { return 1; } return num; } private static CharacterBody ResolveBody(object state) { if (BodyGetter != null) { object? obj = BodyGetter.Invoke(state, null); CharacterBody val = (CharacterBody)((obj is CharacterBody) ? obj : null); if ((Object)(object)val != (Object)null) { return val; } } if (HealthGetter != null) { object? obj2 = HealthGetter.Invoke(state, null); HealthComponent val2 = (HealthComponent)((obj2 is HealthComponent) ? obj2 : null); if ((Object)(object)val2 != (Object)null) { return val2.body; } } return null; } private static float TotalHealPercent() { if (_totalHealPercent == null) { return 50f; } return Math.Max(0f, _totalHealPercent.Value); } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class FloodChargeTime { private const string Section = "VoidFiend"; private const string StateTypeName = "EntityStates.VoidSurvivor.Weapon.ChargeMegaBlaster"; private const int DiagnosticCount = 5; private static readonly Type StateType = AccessTools.TypeByName("EntityStates.VoidSurvivor.Weapon.ChargeMegaBlaster"); private static readonly FieldInfo BaseDurationField = ((StateType != null) ? AccessTools.Field(StateType, "baseDuration") : null); private static readonly FieldInfo DurationField = ((StateType != null) ? AccessTools.Field(StateType, "duration") : null); private static ConfigEntry<float> _scale; private static ManualLogSource _log; private static int _diagCount; public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _scale = cfg.Bind<float>("VoidFiend", "FloodChargeTimeScale", 0.5f, "未腐化「腐化流」蓄力时间的倍率。0.5 = 减半(原版 1.2s -> 0.6s)。\n1 = 保持原版。腐化形态 M2 没有蓄力,不受影响。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_008d: Expected O, but got Unknown if (StateType == null || BaseDurationField == null) { Log((LogLevel)2, "腐化流蓄力:取不到 ChargeMegaBlaster.baseDuration,补丁未挂载。"); return; } MethodInfo methodInfo = AccessTools.Method(StateType, "OnEnter", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "腐化流蓄力:取不到 ChargeMegaBlaster.OnEnter,补丁未挂载。"); return; } harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(FloodChargeTime), "OnEnterPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(FloodChargeTime), "OnEnterPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:ChargeMegaBlaster.OnEnter <- FloodChargeTime(未腐化腐化流蓄力时间 x" + Scale() + ")"); } public static string Summary() { return "腐化流蓄力:x" + Scale() + "(1.2s -> " + (1.2f * Scale()).ToString("0.##") + "s)。"; } private static void OnEnterPrefix(object __instance, out float __state) { __state = 0f; if (__instance == null || BaseDurationField == null) { return; } float num = Scale(); if (num <= 0f || num == 1f) { return; } try { float num2 = (__state = Convert.ToSingle(BaseDurationField.GetValue(__instance))); BaseDurationField.SetValue(__instance, num2 * num); } catch (Exception ex) { Log((LogLevel)4, "腐化流蓄力:改写 baseDuration 失败(已忽略)—— " + ex.GetType().Name + " " + ex.Message); } } private static void OnEnterPostfix(object __instance, float __state) { if (__instance == null || BaseDurationField == null || __state <= 0f) { return; } float num = 0f; if (DurationField != null) { try { num = Convert.ToSingle(DurationField.GetValue(__instance)); } catch (Exception) { num = 0f; } } try { BaseDurationField.SetValue(__instance, __state); } catch (Exception) { } if (_diagCount < 5) { _diagCount++; Log((LogLevel)16, "腐化流蓄力诊断 #" + _diagCount + ":baseDuration " + __state + " x" + Scale() + " -> duration " + num + "。"); } } private static float Scale() { float num = ((_scale != null) ? _scale.Value : 0.5f); if (!(num > 0f)) { return 0.5f; } return num; } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class FloodCollapse { public class FloodCollapseMarker : MonoBehaviour, IProjectileImpactBehavior { public bool Resolved; public void OnProjectileImpact(ProjectileImpactInfo impactInfo) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = impactInfo.estimatedPointOfImpact; if (val == Vector3.zero) { val = ((Component)this).transform.position; } Resolve(((Component)this).gameObject, val, impactInfo.collider); } } private const string Section = "VoidFiend"; private const int DiagnosticCount = 8; private static ConfigEntry<bool> _enabled; private static ConfigEntry<int> _stacksNormal; private static ConfigEntry<int> _stacksCharged; private static ConfigEntry<int> _stacksCorrupted; private static ConfigEntry<float> _duration; private static ConfigEntry<float> _radius; private static ConfigEntry<string> _projectileName; private static ManualLogSource _log; private static bool _attached; private static int _diagCount; private static int _triggerCount; public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return false; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "FloodCollapseEnabled", false, "M2「腐化流」的射弹命中时,是否给敌人挂「瓦解」(3 秒后爆 400% 基础伤害)。\n【1.3.6 起停用】未腐化与腐化形态都不再施加瓦解;本开关保留仅为兼容旧配置。"); _stacksCorrupted = cfg.Bind<int>("VoidFiend", "FloodCollapseStacksCorrupted", 3, "腐化形态(射弹名带 Corrupted)命中时给每个敌人挂几层瓦解。运行期读取。"); _stacksCharged = cfg.Bind<int>("VoidFiend", "FloodCollapseStacksCharged", 2, "未腐化形态 + 完全蓄力(射弹名带 Big)时挂几层。运行期读取。"); _stacksNormal = cfg.Bind<int>("VoidFiend", "FloodCollapseStacksNormal", 1, "未腐化形态 + 没蓄满(射弹名带 Small)时挂几层。运行期读取。"); _duration = cfg.Bind<float>("VoidFiend", "FloodCollapseDuration", 3f, "单层瓦解的存活时长(秒)。3 = 和游戏原版一致(DotDef 的 interval 就是 3)。\n填 0 或负数也按 3 秒算。运行期读取。"); _radius = cfg.Bind<float>("VoidFiend", "FloodCollapseRadius", 0f, "作用半径(米)。0 = 跟着射弹自己的爆炸半径走;纯直击弹(没有爆炸组件)\n在 0 时只作用于被直接命中的那个目标。运行期读取。"); _projectileName = cfg.Bind<string>("VoidFiend", "FloodProjectileName", "VoidSurvivorMegaBlaster", "要改造的射弹预制体名(包含匹配,大小写不敏感)。\n命中这个名字之后,再按 Corrupted / Big / Small 判断是哪一档。\n游戏改版改名了就把这里改成新名字;清空 = 关闭识别。运行期读取。"); } public static void Patch(Harmony harmony) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "腐化流瓦解:按配置保持原版,不挂补丁。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(ProjectileManager), "InitializeProjectile", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "腐化流瓦解补丁失败:取不到 ProjectileManager.InitializeProjectile。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(FloodCollapse), "InitializeProjectilePostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:ProjectileManager.InitializeProjectile <- InitializeProjectilePostfix(腐化流射弹识别)"); MethodInfo methodInfo2 = AccessTools.Method(typeof(ProjectileExplosion), "DetonateServer", (Type[])null, (Type[])null); if (methodInfo2 == null) { Log((LogLevel)2, "腐化流瓦解补丁失败:取不到 ProjectileExplosion.DetonateServer。"); return; } harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(FloodCollapse), "DetonateServerPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:ProjectileExplosion.DetonateServer <- DetonateServerPostfix(腐化流瓦解)"); } public static void InitializeProjectilePostfix(ProjectileController projectileController, FireProjectileInfo fireProjectileInfo) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) GameObject projectilePrefab = fireProjectileInfo.projectilePrefab; if ((Object)(object)projectilePrefab == (Object)null) { return; } string name = ((Object)projectilePrefab).name; bool flag = IsTarget(name); if (name.IndexOf("VoidSurvivor", StringComparison.OrdinalIgnoreCase) >= 0 && _diagCount++ < 10) { Log((LogLevel)16, "腐化流诊断:虚空恶鬼射弹「" + name + "」" + (flag ? (" → 命中目标,打标记(" + StacksFor(name) + " 层)。") : " → 不是目标,跳过。")); } if (!flag || (Object)(object)projectileController == (Object)null) { return; } GameObject gameObject = ((Component)projectileController).gameObject; if (!((Object)(object)gameObject.GetComponent<FloodCollapseMarker>() != (Object)null)) { gameObject.AddComponent<FloodCollapseMarker>(); if (!_attached) { _attached = true; Log((LogLevel)16, "腐化流瓦解:已在射弹「" + name + "」上打标记。"); } } } public static void DetonateServerPostfix(ProjectileExplosion __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null)) { Resolve(((Component)__instance).gameObject, ((Component)__instance).transform.position, null); } } internal unsafe static void Resolve(GameObject projectile, Vector3 center, Collider directHit) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)projectile == (Object)null || !NetworkServer.active) { return; } FloodCollapseMarker component = projectile.GetComponent<FloodCollapseMarker>(); if ((Object)(object)component == (Object)null || component.Resolved || ((Object)(object)directHit != (Object)null && (Object)(object)projectile.GetComponent<ProjectileExplosion>() != (Object)null)) { return; } component.Resolved = true; ProjectileController component2 = projectile.GetComponent<ProjectileController>(); GameObject val = (((Object)(object)component2 != (Object)null) ? component2.owner : null); TeamIndex team = (TeamIndex)(((Object)(object)component2 != (Object)null && (Object)(object)component2.teamFilter != (Object)null) ? ((int)component2.teamFilter.teamIndex) : 0); int stacks = StacksFor(((Object)projectile).name); float num = RadiusValue(); if (num <= 0f) { ProjectileExplosion component3 = projectile.GetComponent<ProjectileExplosion>(); if ((Object)(object)component3 != (Object)null) { num = component3.blastRadius; } } _triggerCount++; bool flag = _triggerCount <= 8; if (flag) { Log((LogLevel)16, "腐化流诊断 #" + _triggerCount + ":「" + ((Object)projectile).name + "」结算,半径 " + num.ToString("0.##") + ",层数 " + stacks + ",队伍 " + ((object)(*(TeamIndex*)(&team))/*cast due to .constrained prefix*/).ToString() + ",攻击者 " + (((Object)(object)val != (Object)null) ? ((Object)val).name : "(无)")); } int num2 = 0; if (num > 0f) { num2 = ApplyInRadius(center, num, team, val, stacks, flag); } else if ((Object)(object)directHit != (Object)null) { HurtBox component4 = ((Component)directHit).GetComponent<HurtBox>(); if ((Object)(object)component4 != (Object)null && (Object)(object)component4.healthComponent != (Object)null && (Object)(object)component4.healthComponent.body != (Object)null && component4.healthComponent.alive) { InflictCollapse(component4.healthComponent.body, val, stacks, flag); num2 = 1; } } if (flag) { Log((LogLevel)16, "腐化流诊断 #" + _triggerCount + ":影响 " + num2 + " 个目标。"); } } private static int ApplyInRadius(Vector3 center, float radius, TeamIndex team, GameObject attacker, int stacks, bool verbose) { //IL_0008: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) HashSet<CharacterBody> handled = new HashSet<CharacterBody>(); int num = 0; BullseyeSearch val = new BullseyeSearch { searchOrigin = center, teamMaskFilter = TeamMask.GetEnemyTeams(team), filterByLoS = false, sortMode = (SortMode)1, maxDistanceFilter = radius }; val.RefreshCandidates(); foreach (HurtBox result in val.GetResults()) { if (TryInflict(result, team, attacker, stacks, handled, verbose)) { num++; } } int num2 = num; foreach (HurtBox item in OverlapHurtBoxes(center, radius)) { if (TryInflict(item, team, attacker, stacks, handled, verbose)) { num++; } } if (verbose) { float num3 = NearestEnemyDistance(center, radius, team); Log((LogLevel)16, "腐化流诊断:中心 " + Format(center) + ",半径 " + radius.ToString("0.##") + " —— BullseyeSearch " + num2 + " 个,物理球补 " + (num - num2) + " 个,合计 " + num + " 个;" + ((num3 >= 0f) ? ("范围内最近的敌人 " + num3.ToString("0.##") + " 米。") : "范围内一个敌人的 HurtBox 都没有。")); } return num; } private static List<HurtBox> OverlapHurtBoxes(Vector3 center, float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) List<HurtBox> list = new List<HurtBox>(); LayerIndex entityPrecise = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { HurtBox val = (((Object)(object)array[i] != (Object)null) ? ((Component)array[i]).GetComponent<HurtBox>() : null); if ((Object)(object)val != (Object)null) { list.Add(val); } } return list; } private static float NearestEnemyDistance(Vector3 center, float radius, TeamIndex team) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) float num = -1f; foreach (HurtBox item in OverlapHurtBoxes(center, radius)) { CharacterBody val = (((Object)(object)item.healthComponent != (Object)null) ? item.healthComponent.body : null); if (!((Object)(object)val == (Object)null) && IsEnemy(val, team)) { float num2 = Vector3.Distance(center, ((Component)item).transform.position); if (num < 0f || num2 < num) { num = num2; } } } return num; } private static bool IsEnemy(CharacterBody body, TeamIndex team) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) TeamComponent teamComponent = body.teamComponent; if (!((Object)(object)teamComponent == (Object)null)) { return teamComponent.teamIndex != team; } return true; } private static bool TryInflict(HurtBox hurtBox, TeamIndex team, GameObject attacker, int stacks, HashSet<CharacterBody> handled, bool verbose) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hurtBox == (Object)null || (Object)(object)hurtBox.healthComponent == (Object)null) { return false; } CharacterBody body = hurtBox.healthComponent.body; if ((Object)(object)body == (Object)null || !body.healthComponent.alive || !IsEnemy(body, team) || !handled.Add(body)) { return false; } InflictCollapse(body, attacker, stacks, verbose); return true; } private static string Format(Vector3 value) { return "(" + value.x.ToString("0.#") + ", " + value.y.ToString("0.#") + ", " + value.z.ToString("0.#") + ")"; } private static void InflictCollapse(CharacterBody body, GameObject attacker, int stacks, bool verbose) { //IL_000c: 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) float duration = DurationValue(); for (int i = 0; i < stacks; i++) { InflictDotInfo val = new InflictDotInfo { victimObject = ((Component)body).gameObject, attackerObject = attacker, dotIndex = (DotIndex)8, duration = duration, damageMultiplier = 1f }; DotController.InflictDot(ref val); } if (verbose) { Log((LogLevel)16, "腐化流诊断:→ " + ((Object)body).name + " 挂 " + stacks + " 层瓦解。"); } } private static int StacksFor(string prefabName) { if (prefabName.IndexOf("Corrupted", StringComparison.OrdinalIgnoreCase) >= 0) { return StacksCorrupted(); } if (prefabName.IndexOf("Big", StringComparison.OrdinalIgnoreCase) >= 0) { return StacksCharged(); } return StacksNormal(); } private static bool IsTarget(string prefabName) { string value = MatchValue(); if (string.IsNullOrEmpty(value)) { return false; } return prefabName.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0; } private static string MatchValue() { if (_projectileName == null) { return string.Empty; } return _projectileName.Value; } private static int StacksNormal() { int num = ((_stacksNormal == null) ? 1 : _stacksNormal.Value); if (num <= 0) { return 1; } return num; } private static int StacksCharged() { int num = ((_stacksCharged != null) ? _stacksCharged.Value : 2); if (num <= 0) { return 1; } return num; } private static int StacksCorrupted() { int num = ((_stacksCorrupted != null) ? _stacksCorrupted.Value : 3); if (num <= 0) { return 1; } return num; } private static float DurationValue() { float num = ((_duration != null) ? _duration.Value : 3f); if (!(num > 0f)) { return 3f; } return num; } private static float RadiusValue() { if (_radius == null) { return 0f; } return _radius.Value; } public static string Summary() { if (!IsEnabled) { return "腐化流瓦解:关。"; } return "腐化流瓦解:未腐化 " + StacksNormal() + " 层 / 蓄满 " + StacksCharged() + " 层 / 腐化 " + StacksCorrupted() + " 层," + DurationValue().ToString("0.#") + " 秒后爆(每层 400% 基础伤害)" + ((RadiusValue() > 0f) ? (",半径 " + RadiusValue().ToString("0.#") + " 米") : ",半径跟随爆炸") + "。"; } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class FloodIndependentWeapon { private const string Section = "VoidFiend"; private const string DefaultMachineName = "FloodWeapon"; private const string BodyName = "VoidSurvivorBody"; private static readonly string[] FallbackStateTypes = new string[3] { "EntityStates.VoidSurvivor.Weapon.ChargeMegaBlaster", "EntityStates.VoidSurvivor.Weapon.ReadyMegaBlaster", "EntityStates.VoidSurvivor.Weapon.FireMegaBlasterBase" }; private static ConfigEntry<bool> _enabled; private static ConfigEntry<string> _machineName; private static ConfigEntry<bool> _fallback; private const int DiagnosticCount = 5; private static Harmony _harmony; private static ManualLogSource _log; private static bool _done; private static bool _ok; private static bool _fallbackPatched; private static int _diagCount; private static FieldInfo _stateMachineField; public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return false; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "FloodIndependentMachineEnabled", true, "M2「腐化流」是不是单独开一个状态机跑。\n开:M2 蓄力/释放期间 M1 照常射击,M2 蓄力时也能随时按 M1(两种形态都算)。\n关:完全保持原版(M2 蓄力时 M1 按不动)。"); _machineName = cfg.Bind<string>("VoidFiend", "FloodIndependentMachineName", "FloodWeapon", "给 M2 单独用的状态机名字。一般不用改,除非和别的模组撞名。改了要重开游戏。"); _fallback = cfg.Bind<bool>("VoidFiend", "FloodInterruptFallback", true, "独立状态机没搭起来时的兜底:把 M2 蓄力/发射状态的打断优先级压到最低,\n让 M1 至少能打断它。代价是蓄力会被取消(等于白蓄)。只在搭状态机失败时生效。"); } public static void Patch(Harmony harmony) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown _harmony = harmony; if (!IsEnabled) { Log((LogLevel)16, "腐化流独立状态机:按配置保持原版。"); return; } ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)Setup); Log((LogLevel)16, "已注册回调:BodyCatalog.available -> Setup(腐化流独立状态机)"); MethodInfo methodInfo = AccessTools.Method(typeof(GenericSkill), "PickTargetStateMachine", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "腐化流独立状态机:取不到 GenericSkill.PickTargetStateMachine。"); return; } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(FloodIndependentWeapon), "PickTargetStateMachinePostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:GenericSkill.PickTargetStateMachine <- PickTargetStateMachinePostfix(M2 槽强制走独立状态机)"); } private static void PickTargetStateMachinePostfix(GenericSkill __instance) { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } CharacterBody characterBody = __instance.characterBody; GameObject val = (((Object)(object)characterBody != (Object)null) ? ((Component)characterBody).gameObject : ((Component)__instance).gameObject); if ((Object)(object)val == (Object)null || ((Object)val).name.IndexOf("VoidSurvivor", StringComparison.OrdinalIgnoreCase) < 0) { return; } SkillLocator component = ((Component)__instance).GetComponent<SkillLocator>(); if ((Object)(object)component == (Object)null || (Object)(object)component.secondary != (Object)(object)__instance) { return; } string text = MachineNameValue(); EntityStateMachine val2 = EntityStateMachine.FindByCustomName(val, text); if ((Object)(object)val2 == (Object)null) { return; } if (_stateMachineField == null) { _stateMachineField = AccessTools.Field(typeof(GenericSkill), "<stateMachine>k__BackingField"); if (_stateMachineField == null) { Log((LogLevel)2, "腐化流独立状态机:取不到 GenericSkill.stateMachine 的 backing field。"); return; } } EntityStateMachine stateMachine = __instance.stateMachine; if ((Object)(object)stateMachine != (Object)(object)val2) { _stateMachineField.SetValue(__instance, val2); } SkillDef skillDef = __instance.skillDef; if ((Object)(object)skillDef != (Object)null && !string.Equals(skillDef.activationStateMachineName, text, StringComparison.Ordinal)) { skillDef.activationStateMachineName = text; } if (_diagCount++ < 5) { Log((LogLevel)16, "腐化流诊断:M2 槽取状态机 —— 技能「" + SkillName(skillDef) + "」,激活状态 " + StateName((SerializableEntityStateType)(((Object)(object)skillDef != (Object)null) ? skillDef.activationState : default(SerializableEntityStateType))) + ",槽位缓存 " + (((Object)(object)stateMachine != (Object)null) ? stateMachine.customName : "(无)") + " → " + val2.customName); } } private static string SkillName(SkillDef skillDef) { if (!((Object)(object)skillDef != (Object)null) || string.IsNullOrEmpty(skillDef.skillNameToken)) { return "(无名)"; } return skillDef.skillNameToken; } private static void Setup() { if (_done) { return; } _done = true; try { SetupMachine(); } catch (Exception ex) { Log((LogLevel)2, "腐化流独立状态机:搭建时抛异常 —— " + ex); PatchFallback(); } } private static void SetupMachine() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = FindBodyPrefab(); if ((Object)(object)val == (Object)null) { Log((LogLevel)2, "腐化流独立状态机:在 BodyCatalog 里找不到虚空恶鬼的 body 预制体(找的是名字里带 VoidSurvivor 的),改不动。"); PatchFallback(); return; } string text = MachineNameValue(); EntityStateMachine[] components = val.GetComponents<EntityStateMachine>(); List<string> list = new List<string>(); for (int i = 0; i < components.Length; i++) { list.Add(components[i].customName); if (string.Equals(components[i].customName, text, StringComparison.Ordinal)) { Log((LogLevel)16, "腐化流独立状态机:「" + ((Object)val).name + "」上已经有「" + text + "」了,跳过。"); _ok = true; return; } } Log((LogLevel)16, "腐化流独立状态机:虚空恶鬼 prefab「" + ((Object)val).name + "」,现有状态机 [" + string.Join(", ", list.ToArray()) + "]"); EntityStateMachine val2 = null; for (int j = 0; j < components.Length; j++) { if (string.Equals(components[j].customName, "Weapon", StringComparison.Ordinal)) { val2 = components[j]; break; } } EntityStateMachine val3 = val.AddComponent<EntityStateMachine>(); val3.customName = text; SerializableEntityStateType stateType = (val3.mainStateType = (val3.initialStateType = PickIdleState(val2))); if ((Object)(object)val2 != (Object)null) { val3.AllowStartWithoutNetworker = val2.AllowStartWithoutNetworker; val3.ShouldStateTransitionOnUpdate = val2.ShouldStateTransitionOnUpdate; Log((LogLevel)16, "腐化流独立状态机:已建「" + text + "」,初始/主状态 = " + StateName(stateType) + "(Weapon 用的是 " + StateName(val2.mainStateType) + ")"); } else { Log((LogLevel)4, "腐化流独立状态机:prefab 上没有 customName = Weapon 的状态机,只能按默认参数建「" + text + "」,初始/主状态 = " + StateName(stateType) + "。"); } RegisterForNetwork(val, val3); RedirectSecondary(val, text); _ok = true; } private static void RegisterForNetwork(GameObject prefab, EntityStateMachine flood) { NetworkStateMachine component = prefab.GetComponent<NetworkStateMachine>(); if ((Object)(object)component == (Object)null) { Log((LogLevel)4, "腐化流独立状态机:prefab 上没有 NetworkStateMachine,新状态机不会被同步(单机无所谓,联机时别人看不到 M2 动作)。"); return; } FieldInfo fieldInfo = AccessTools.Field(typeof(NetworkStateMachine), "stateMachines"); if (fieldInfo == null) { Log((LogLevel)4, "腐化流独立状态机:取不到 NetworkStateMachine.stateMachines 字段,新状态机不会被同步(单机无所谓,联机时别人看不到 M2 动作)。"); return; } List<EntityStateMachine> list = new List<EntityStateMachine>(); if (fieldInfo.GetValue(component) is EntityStateMachine[] collection) { list.AddRange(collection); } if (!list.Contains(flood)) { list.Add(flood); fieldInfo.SetValue(component, list.ToArray()); Log((LogLevel)16, "腐化流独立状态机:已把「" + flood.customName + "」加进 NetworkStateMachine(共 " + list.Count + " 个状态机)。"); } } private static void RedirectSecondary(GameObject prefab, string machineName) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = prefab.GetComponent<SkillLocator>(); if ((Object)(object)component == (Object)null || (Object)(object)component.secondary == (Object)null) { Log((LogLevel)2, "腐化流独立状态机:prefab 上取不到 SkillLocator.secondary。"); PatchFallback(); return; } SkillFamily skillFamily = component.secondary.skillFamily; if ((Object)(object)skillFamily == (Object)null || skillFamily.variants == null || skillFamily.variants.Length == 0) { Log((LogLevel)2, "腐化流独立状态机:M2 的 SkillFamily 是空的。"); PatchFallback(); return; } int num = 0; Variant[] variants = skillFamily.variants; for (int i = 0; i < variants.Length; i++) { SkillDef skillDef = variants[i].skillDef; if (!((Object)(object)skillDef == (Object)null)) { string activationStateMachineName = skillDef.activationStateMachineName; skillDef.activationStateMachineName = machineName; num++; Log((LogLevel)16, "腐化流独立状态机:M2 技能「" + skillDef.skillNameToken + "」状态机 " + (string.IsNullOrEmpty(activationStateMachineName) ? "(空)" : activationStateMachineName) + " → " + machineName + "(激活状态 " + StateName(skillDef.activationState) + ")"); } } if (num == 0) { Log((LogLevel)2, "腐化流独立状态机:M2 家族里一个 SkillDef 都没改到。"); PatchFallback(); return; } Log((LogLevel)16, "腐化流独立状态机:共 " + num + " 个 M2 技能已改到「" + machineName + "」,M1 留在 Weapon,两边互不干扰。"); } private static GameObject FindBodyPrefab() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) BodyIndex val = BodyCatalog.FindBodyIndex("VoidSurvivorBody"); if ((int)val != -1) { GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(val); if ((Object)(object)bodyPrefab != (Object)null) { return bodyPrefab; } } foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { if ((Object)(object)allBodyPrefab != (Object)null && ((Object)allBodyPrefab).name.IndexOf("VoidSurvivor", StringComparison.OrdinalIgnoreCase) >= 0) { return allBodyPrefab; } } return null; } private static SerializableEntityStateType PickIdleState(EntityStateMachine weapon) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)weapon != (Object)null) { Type stateType = ((SerializableEntityStateType)(ref weapon.mainStateType)).stateType; if (stateType != null && stateType != typeof(Uninitialized)) { return weapon.mainStateType; } } return new SerializableEntityStateType(typeof(Idle)); } private static string StateName(SerializableEntityStateType stateType) { Type stateType2 = ((SerializableEntityStateType)(ref stateType)).stateType; if (stateType2 != null) { return stateType2.Name; } if (!string.IsNullOrEmpty(((SerializableEntityStateType)(ref stateType)).typeName)) { return ((SerializableEntityStateType)(ref stateType)).typeName; } return "(空)"; } private static void PatchFallback() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown if (_fallbackPatched || _harmony == null) { return; } _fallbackPatched = true; if (_fallback == null || !_fallback.Value) { Log((LogLevel)4, "腐化流独立状态机:搭不起来,且兜底方案按配置关闭,M2 保持原版。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(FloodIndependentWeapon), "LowerPriorityPostfix", (Type[])null, (Type[])null); string[] fallbackStateTypes = FallbackStateTypes; foreach (string text in fallbackStateTypes) { Type type = AccessTools.TypeByName(text); if (type == null) { Log((LogLevel)4, "腐化流兜底补丁:找不到类型 " + text + "。"); continue; } MethodInfo methodInfo2 = AccessTools.Method(type, "GetMinimumInterruptPriority", (Type[])null, (Type[])null); if (methodInfo2 == null) { Log((LogLevel)4, "腐化流兜底补丁:" + text + " 上没有 GetMinimumInterruptPriority。"); continue; } _harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "兜底补丁已挂载:" + text + ".GetMinimumInterruptPriority -> Any(M1 可打断 M2,但蓄力会丢)"); } } private static void LowerPriorityPostfix(ref InterruptPriority __result) { __result = (InterruptPriority)0; } private static string MachineNameValue() { string text = ((_machineName != null) ? _machineName.Value : null); if (!string.IsNullOrEmpty(text)) { return text; } return "FloodWeapon"; } public static string Summary() { if (!IsEnabled) { return "腐化流独立状态机:关(M2 蓄力时 M1 按不动,原版行为)。"; } if (_ok) { return "腐化流独立状态机:M2 跑在「" + MachineNameValue() + "」,M1 留在 Weapon,互不打断。"; } return "腐化流独立状态机:还没搭好(等 BodyCatalog 就绪,或已失败、走了兜底)。"; } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class PrimaryFireRate { private const string Section = "VoidFiend"; private const int DiagnosticCount = 6; private static ConfigEntry<bool> _enabled; private static ConfigEntry<float> _baseDuration; private static ManualLogSource _log; private static int _diagCount; private static float _lastOriginal = -1f; private static readonly FieldInfo BaseDurationField = AccessTools.Field(typeof(FireHandBeam), "baseDuration"); private static readonly FieldInfo DurationField = AccessTools.Field(typeof(FireHandBeam), "duration"); private static readonly FieldInfo AttackSpeedStatField = AccessTools.Field(typeof(BaseState), "attackSpeedStat"); public static bool IsEnabled { get { if (_enabled != null) { return _enabled.Value; } return false; } } public static void Init(ConfigFile cfg, ManualLogSource logger) { _log = logger; _enabled = cfg.Bind<bool>("VoidFiend", "PrimaryBaseDurationEnabled", true, "是否调整未腐化形态 M1 的攻击间隔。false = 保持原版。"); _baseDuration = cfg.Bind<float>("VoidFiend", "PrimaryBaseDuration", 0.5f, "未腐化形态 M1 的攻击间隔(秒)。原版 0.6,越小打得越快。\n实际间隔还要除以攻击速度。运行期读取,改了下一发就生效。"); } public static void Patch(Harmony harmony) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00a6: Expected O, but got Unknown if (!IsEnabled) { Log((LogLevel)16, "未腐化 M1 攻速:按配置保持原版,不挂补丁。"); return; } if (BaseDurationField == null || DurationField == null) { Log((LogLevel)2, "未腐化 M1 攻速补丁失败:取不到 FireHandBeam 的 baseDuration / duration 字段。"); return; } MethodInfo methodInfo = AccessTools.Method(typeof(FireHandBeam), "OnEnter", (Type[])null, (Type[])null); if (methodInfo == null) { Log((LogLevel)2, "未腐化 M1 攻速补丁失败:取不到 FireHandBeam.OnEnter。"); return; } harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(PrimaryFireRate), "OnEnterPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(PrimaryFireRate), "OnEnterPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log((LogLevel)16, "补丁已挂载:EntityStates.VoidSurvivor.Weapon.FireHandBeam.OnEnter(未腐化 M1 攻击间隔)"); } public static string Summary() { return "未腐化 M1 攻击间隔:" + BaseDurationValue().ToString("0.###") + " 秒。"; } private static void OnEnterPrefix(object __instance) { if (__instance != null && IsEnabled) { _lastOriginal = (float)BaseDurationField.GetValue(__instance); float num = BaseDurationValue(); if (Math.Abs(_lastOriginal - num) > 0.0001f) { BaseDurationField.SetValue(__instance, num); } } } private static void OnEnterPostfix(object __instance) { if (__instance != null) { float num = ((AttackSpeedStatField != null) ? ((float)AttackSpeedStatField.GetValue(__instance)) : 1f); if (num < 0.0001f) { num = 1f; } float num2 = BaseDurationValue() / num; float num3 = (float)DurationField.GetValue(__instance); if (num3 > num2 + 0.0001f) { DurationField.SetValue(__instance, num2); num3 = num2; } if (_diagCount < 6) { _diagCount++; Log((LogLevel)16, "未腐化 M1 诊断 #" + _diagCount + ":原版 baseDuration " + _lastOriginal.ToString("0.###") + " → 目标 " + BaseDurationValue().ToString("0.###") + ",攻击速度 " + num.ToString("0.###") + ",最终时长 " + num3.ToString("0.###") + " 秒。"); } } } private static float BaseDurationValue() { float num = ((_baseDuration != null) ? _baseDuration.Value : 0.5f); if (!(num > 0f)) { return 0.5f; } return num; } private static void Log(LogLevel level, string message) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_log != null) { _log.Log(level, (object)message); } } } public static class VoidDamage { private sealed class InterceptState { public DamageInfo Info; public HealthComponent Health; public float Damage; public DamageTypeCombo Combo; public DamageCol