using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Merc;
using EntityStates.Merc.Weapon;
using HIFUMercenaryTweaks.Skills;
using HarmonyLib;
using IL.EntityStates.Merc;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Merc;
using On.EntityStates.Merc.Weapon;
using R2API;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HIFUMercenaryTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HIFUMercenaryTweaks")]
[assembly: AssemblyTitle("HIFUMercenaryTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HIFUMercenaryTweaks
{
public class ConfigManager
{
internal static bool ConfigChanged;
internal static bool VersionChanged;
public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
where x.Name == "Bind"
select x).First();
methodInfo = methodInfo.MakeGenericMethod(typeof(T));
object[] parameters = new object[3]
{
(object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + entry.Definition.Section, name),
entry.DefaultValue,
(object)new ConfigDescription(entry.Description.Description, (AcceptableValueBase)null, Array.Empty<object>())
};
ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, parameters);
if (Main._preVersioning)
{
entry.BoxedValue = entry.DefaultValue;
}
if (!ConfigEqual(val.DefaultValue, val.BoxedValue) && VersionChanged)
{
entry.BoxedValue = entry.DefaultValue;
val.BoxedValue = val.DefaultValue;
}
return default(T);
}
private static bool ConfigEqual(object a, object b)
{
if (a.Equals(b))
{
return true;
}
if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001)
{
return true;
}
return false;
}
}
public static class Keywords
{
public static void Init()
{
LanguageAPI.Add("KEYWORD_FLEETING", "<style=cKeywordName>Fleeting</style><style=cSub><style=cIsDamage>Attack speed</style> increases <style=cIsDamage>skill damage</style> instead.");
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("HIFU.HIFUMercenaryTweaks", "HIFUMercenaryTweaks", "1.1.2")]
public class Main : BaseUnityPlugin
{
public const string PluginGUID = "HIFU.HIFUMercenaryTweaks";
public const string PluginAuthor = "HIFU";
public const string PluginName = "HIFUMercenaryTweaks";
public const string PluginVersion = "1.1.2";
public static ConfigFile HMTConfig;
public static ConfigFile HMTBackupConfig;
public static ManualLogSource HMTLogger;
public static bool _preVersioning;
public static ConfigEntry<bool> enableAutoConfig { get; set; }
public static ConfigEntry<string> latestVersion { get; set; }
public static ConfigEntry<bool> scaleSomeSkillDamageWithAttackSpeed { get; set; }
public void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
HMTLogger = ((BaseUnityPlugin)this).Logger;
HMTConfig = ((BaseUnityPlugin)this).Config;
HMTBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFUMercenaryTweaks.Backup.cfg", true);
HMTBackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :");
enableAutoConfig = HMTConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFUMercenaryTweaks from syncing config whenever a new version is found.");
_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HMTConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
latestVersion = HMTConfig.Bind<string>("Config", "Latest Version", "1.1.2", "DO NOT CHANGE THIS");
if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.2"))
{
latestVersion.Value = "1.1.2";
ConfigManager.VersionChanged = true;
HMTLogger.LogInfo((object)"Config Autosync Enabled.");
}
scaleSomeSkillDamageWithAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Non-Special Skills :: Scaling", "Scale Damage with Attack Speed?", true, "Vanilla is false");
Keywords.Init();
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
select type;
HMTLogger.LogInfo((object)"==+----------------==TWEAKS==----------------+==");
foreach (Type item in enumerable)
{
TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item);
if (ValidateTweak(tweakBase))
{
tweakBase.Init();
}
}
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(MiscBase))
select type;
HMTLogger.LogInfo((object)"==+----------------==MISC==----------------+==");
foreach (Type item2 in enumerable2)
{
MiscBase miscBase = (MiscBase)Activator.CreateInstance(item2);
if (ValidateMisc(miscBase))
{
miscBase.Init();
}
}
if (Eviscerate.allowMovement)
{
GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercBody.prefab").WaitForCompletion();
EntityStateMachine val2 = val.AddComponent<EntityStateMachine>();
val2.customName = "Evis";
val2.initialStateType = new SerializableEntityStateType(typeof(Idle));
val2.mainStateType = new SerializableEntityStateType(typeof(Idle));
NetworkStateMachine component = val.GetComponent<NetworkStateMachine>();
Array.Resize(ref component.stateMachines, component.stateMachines.Length + 1);
component.stateMachines[component.stateMachines.Length - 1] = val2;
SkillDef val3 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyEvis.asset").WaitForCompletion();
val3.activationStateMachineName = "Evis";
}
}
public bool ValidateTweak(TweakBase tb)
{
if (tb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(tb.Name, "Enable?", true, "Vanilla is false").Value)
{
return true;
}
return false;
}
public bool ValidateMisc(MiscBase mb)
{
if (mb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(mb.Name, "Enable?", true, "Vanilla is false").Value)
{
return true;
}
return false;
}
private void PERIPHERYVSWEEP()
{
}
}
public abstract class MiscBase
{
public abstract string Name { get; }
public virtual bool isEnabled { get; } = true;
public T ConfigOption<T>(T value, string name, string description)
{
ConfigEntry<T> val = Main.HMTConfig.Bind<T>(Name, name, value, description);
ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HMTBackupConfig, name);
return val.Value;
}
public abstract void Hooks();
public string d(float f)
{
return f * 100f + "%";
}
public virtual void Init()
{
Hooks();
Main.HMTLogger.LogInfo((object)("Added " + Name));
}
}
public abstract class MiscBase<T> : MiscBase where T : MiscBase<T>
{
public static T instance { get; set; }
public MiscBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice");
}
instance = this as T;
}
}
public abstract class TweakBase
{
public bool done = false;
public abstract string Name { get; }
public abstract string SkillToken { get; }
public abstract string DescText { get; }
public virtual bool isEnabled { get; } = true;
public T ConfigOption<T>(T value, string name, string description)
{
ConfigEntry<T> val = Main.HMTConfig.Bind<T>(Name, name, value, description);
ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HMTBackupConfig, name);
if (!done)
{
done = true;
}
return val.Value;
}
public abstract void Hooks();
public string d(float f)
{
return f * 100f + "%";
}
public virtual void Init()
{
Hooks();
string text = "MERC_" + SkillToken.ToUpper() + "_DESCRIPTION";
LanguageAPI.Add(text, DescText);
Main.HMTLogger.LogInfo((object)("Added " + Name));
}
}
public abstract class TweakBase<T> : TweakBase where T : TweakBase<T>
{
public static T instance { get; set; }
public TweakBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice");
}
instance = this as T;
}
}
}
namespace HIFUMercenaryTweaks.Skills
{
internal class BlindingAssault : TweakBase<BlindingAssault>
{
public static bool scaleDurationWithAttackSpeed;
public override string Name => "Utility : Blinding Assault";
public override string SkillToken => "utility";
public override string DescText => (Main.scaleSomeSkillDamageWithAttackSpeed.Value ? "<style=cIsDamage>Fleeting</style>. " : "") + "<style=cIsDamage>Stunning</style>. Dash forward, dealing <style=cIsDamage>300% damage</style>. If you hit an enemy, <style=cIsDamage>you can dash again</style>, up to <style=cIsDamage>3</style> total.";
public override void Init()
{
scaleDurationWithAttackSpeed = ConfigOption(value: false, "Scale animation speed with Attack Speed?", "Vanilla is true");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
PrepAssaulter2.OnEnter += new hook_OnEnter(PrepAssaulter2_OnEnter);
Assaulter2.OnEnter += new hook_OnEnter(Assaulter2_OnEnter);
Assaulter2.AuthorityModifyOverlapAttack += new hook_AuthorityModifyOverlapAttack(Assaulter2_AuthorityModifyOverlapAttack);
Changes();
}
private void Assaulter2_AuthorityModifyOverlapAttack(orig_AuthorityModifyOverlapAttack orig, Assaulter2 self, OverlapAttack overlapAttack)
{
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value && ((EntityState)self).isAuthority)
{
float damageCoefficient = 3f + 3f * ((((BaseState)self).attackSpeedStat - 1f) * (1f / 3f));
((BasicMeleeAttack)self).damageCoefficient = damageCoefficient;
}
orig.Invoke(self, overlapAttack);
}
private void Assaulter2_OnEnter(orig_OnEnter orig, Assaulter2 self)
{
orig.Invoke(self);
if (!scaleDurationWithAttackSpeed)
{
((BasicMeleeAttack)self).duration = ((BasicMeleeAttack)self).baseDuration;
}
}
private void PrepAssaulter2_OnEnter(orig_OnEnter orig, PrepAssaulter2 self)
{
orig.Invoke(self);
if (!scaleDurationWithAttackSpeed)
{
self.duration = PrepAssaulter2.baseDuration;
}
}
private void Changes()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value)
{
string[] keywordTokens = new string[2] { "KEYWORD_FLEETING", "KEYWORD_STUNNING" };
MercDashSkillDef val = Addressables.LoadAssetAsync<MercDashSkillDef>((object)"RoR2/Base/Merc/MercBodyAssaulter.asset").WaitForCompletion();
((SkillDef)val).keywordTokens = keywordTokens;
}
}
}
public class Eviscerate : TweakBase<Eviscerate>
{
public static float damageCoefficient;
public static float cooldown;
public static bool allowMovement;
public static bool ignoreAllies;
public static bool removeCameraChanges;
public override string Name => "Special : Eviscerate";
public override string SkillToken => "special";
public override string DescText => "Target the nearest enemy, attacking them for <style=cIsDamage>" + d(damageCoefficient) + " damage</style> repeatedly. <style=cIsUtility>You cannot be hit for the duration</style>.";
public override void Init()
{
damageCoefficient = ConfigOption(1.3f, "Damage", "Decimal. Vanilla is 1.1");
allowMovement = ConfigOption(value: true, "Enable movement and using other skills?", "Vanilla is false");
ignoreAllies = ConfigOption(value: true, "Improve targetting and ignore allies?", "Vanilla is false");
removeCameraChanges = ConfigOption(value: true, "Remove camera changes?", "Vanilla is false");
cooldown = ConfigOption(7f, "Cooldown", "Vanilla is 6");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
Evis.OnEnter += new hook_OnEnter(Evis_OnEnter);
if (removeCameraChanges)
{
Evis.OnEnter += new Manipulator(Evis_OnEnter1);
EvisDash.OnEnter += new Manipulator(EvisDash_OnEnter);
}
Evis.SearchForTarget += new hook_SearchForTarget(Evis_SearchForTarget);
Evis.FixedUpdate += new hook_FixedUpdate(Evis_FixedUpdate);
EvisDash.FixedUpdate += new hook_FixedUpdate(EvisDash_FixedUpdate);
Changes();
}
private void EvisDash_FixedUpdate(orig_FixedUpdate orig, EvisDash self)
{
//IL_004f: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Expected O, but got Unknown
if (ignoreAllies)
{
self.stopwatch += Time.fixedDeltaTime;
if (self.stopwatch > EvisDash.dashPrepDuration && !self.isDashing)
{
self.isDashing = true;
self.dashVector = ((EntityState)self).inputBank.aimDirection;
self.CreateBlinkEffect(Util.GetCorePosition(((EntityState)self).gameObject));
((EntityState)self).PlayCrossfade("FullBody, Override", "EvisLoop", 0.1f);
if (Object.op_Implicit((Object)(object)self.modelTransform))
{
CharacterModel component = ((Component)self.modelTransform).GetComponent<CharacterModel>();
TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((Component)self.modelTransform).gameObject);
val.duration = 0.6f;
val.animateShaderAlpha = true;
val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
val.destroyComponentOnEnd = true;
val.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matHuntressFlashBright");
val.inspectorCharacterModel = component;
TemporaryOverlayInstance val2 = TemporaryOverlayManager.AddOverlay(((Component)self.modelTransform).gameObject);
val2.duration = 0.7f;
val2.animateShaderAlpha = true;
val2.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
val2.destroyComponentOnEnd = true;
val2.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matHuntressFlashExpanded");
val2.inspectorCharacterModel = component;
}
}
bool flag = self.stopwatch >= EvisDash.dashDuration + EvisDash.dashPrepDuration;
if (self.isDashing)
{
if (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)self).characterDirection))
{
CharacterMotor characterMotor = ((EntityState)self).characterMotor;
characterMotor.rootMotion += self.dashVector * (((BaseState)self).moveSpeedStat * EvisDash.speedCoefficient * Time.fixedDeltaTime);
}
if (((EntityState)self).isAuthority)
{
Collider[] array = Physics.OverlapSphere(((EntityState)self).transform.position, ((EntityState)self).characterBody.radius + EvisDash.overlapSphereRadius * (flag ? EvisDash.lollypopFactor : 1f), LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask));
for (int i = 0; i < array.Length; i++)
{
HurtBox component2 = ((Component)array[i]).GetComponent<HurtBox>();
if (Object.op_Implicit((Object)(object)component2) && component2.teamIndex != ((EntityState)self).teamComponent.teamIndex)
{
Evis nextState = new Evis();
((EntityState)self).outer.SetNextState((EntityState)(object)nextState);
return;
}
}
}
}
if (flag && ((EntityState)self).isAuthority)
{
((EntityState)self).outer.SetNextStateToMain();
}
}
else
{
orig.Invoke(self);
}
}
private void EvisDash_OnEnter(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 2)
}))
{
val.Remove();
val.Emit(OpCodes.Ldc_I4, 3);
}
else
{
Main.HMTLogger.LogError((object)"Failed to apply Eviscerate Camera hook");
}
}
private void Evis_OnEnter1(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 2)
}))
{
val.Remove();
val.Emit(OpCodes.Ldc_I4, 3);
}
else
{
Main.HMTLogger.LogError((object)"Failed to apply Eviscerate Camera hook");
}
}
private void Evis_FixedUpdate(orig_FixedUpdate orig, Evis self)
{
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
if (allowMovement)
{
self.stopwatch += Time.fixedDeltaTime;
self.attackStopwatch += Time.fixedDeltaTime;
float num = 1f / Evis.damageFrequency / ((BaseState)self).attackSpeedStat;
if (self.attackStopwatch >= num)
{
self.attackStopwatch -= num;
HurtBox val = self.SearchForTarget();
if (Object.op_Implicit((Object)(object)val))
{
Util.PlayAttackSpeedSound(Evis.slashSoundString, ((EntityState)self).gameObject, Evis.slashPitch);
Util.PlaySound(Evis.dashSoundString, ((EntityState)self).gameObject);
Util.PlaySound(Evis.impactSoundString, ((EntityState)self).gameObject);
HurtBoxGroup hurtBoxGroup = val.hurtBoxGroup;
HurtBox val2 = hurtBoxGroup.hurtBoxes[0];
if (Object.op_Implicit((Object)(object)val2))
{
Vector3 position = ((Component)val2).transform.position;
Vector2 insideUnitCircle = Random.insideUnitCircle;
Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(normalized.x, 0f, normalized.y);
EffectManager.SimpleImpactEffect(Evis.hitEffectPrefab, position, val3, false);
Transform transform = ((Component)val.hurtBoxGroup).transform;
TemporaryOverlayInstance val4 = TemporaryOverlayManager.AddOverlay(((Component)self.modelTransform).gameObject);
val4.duration = num;
val4.animateShaderAlpha = true;
val4.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
val4.destroyComponentOnEnd = true;
val4.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matMercEvisTarget");
val4.inspectorCharacterModel = ((Component)((EntityState)self).transform).GetComponent<CharacterModel>();
if (NetworkServer.active)
{
DamageInfo val5 = new DamageInfo();
val5.damage = Evis.damageCoefficient * ((BaseState)self).damageStat;
val5.attacker = ((EntityState)self).gameObject;
val5.procCoefficient = Evis.procCoefficient;
val5.position = ((Component)val2).transform.position;
val5.crit = self.crit;
val2.healthComponent.TakeDamage(val5);
GlobalEventManager.instance.OnHitEnemy(val5, ((Component)val2.healthComponent).gameObject);
GlobalEventManager.instance.OnHitAll(val5, ((Component)val2.healthComponent).gameObject);
}
}
}
else if (((EntityState)self).isAuthority && self.stopwatch > Evis.minimumDuration)
{
((EntityState)self).outer.SetNextStateToMain();
}
}
if (self.stopwatch >= Evis.duration && ((EntityState)self).isAuthority)
{
((EntityState)self).outer.SetNextStateToMain();
}
}
else
{
orig.Invoke(self);
}
}
private HurtBox Evis_SearchForTarget(orig_SearchForTarget orig, Evis self)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_0049: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
if (ignoreAllies)
{
BullseyeSearch val = new BullseyeSearch
{
searchOrigin = ((EntityState)self).transform.position,
searchDirection = ((EntityState)self).inputBank.aimDirection,
maxDistanceFilter = Evis.maxRadius,
teamMaskFilter = TeamMask.AllExcept(((BaseState)self).GetTeam()),
sortMode = (SortMode)2
};
val.RefreshCandidates();
val.FilterOutGameObject(((EntityState)self).gameObject);
return val.GetResults().FirstOrDefault();
}
return orig.Invoke(self);
}
private void Evis_OnEnter(orig_OnEnter orig, Evis self)
{
Evis.damageCoefficient = damageCoefficient;
orig.Invoke(self);
}
private void Changes()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyEvis.asset").WaitForCompletion();
val.baseRechargeInterval = cooldown;
}
}
internal class FocusedAssault : TweakBase<FocusedAssault>
{
public static bool scaleDurationWithAttackSpeed;
public override string Name => "Utility :: Focused Assault";
public override string SkillToken => "utility_alt1";
public override string DescText => (Main.scaleSomeSkillDamageWithAttackSpeed.Value ? "<style=cIsDamage>Fleeting</style>. " : "") + "<style=cIsDamage>Stunning</style>. Dash forward, dealing <style=cIsDamage>700% damage</style> and <style=cIsUtility>Exposing</style> enemies after <style=cIsUtility>1 second</style>.";
public override void Init()
{
scaleDurationWithAttackSpeed = ConfigOption(value: false, "Scale animation speed with Attack Speed?", "Vanilla is true");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
FocusedAssaultPrep.OnEnter += new hook_OnEnter(FocusedAssaultPrep_OnEnter);
FocusedAssaultDash.AuthorityModifyOverlapAttack += new hook_AuthorityModifyOverlapAttack(FocusedAssaultDash_AuthorityModifyOverlapAttack);
FocusedAssaultDash.OnEnter += new hook_OnEnter(FocusedAssaultDash_OnEnter);
Changes();
}
private void FocusedAssaultDash_AuthorityModifyOverlapAttack(orig_AuthorityModifyOverlapAttack orig, FocusedAssaultDash self, OverlapAttack overlapAttack)
{
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value && ((EntityState)self).isAuthority)
{
float delayedDamageCoefficient = 7f + 7f * ((((BaseState)self).attackSpeedStat - 1f) * 0.4285714f);
self.delayedDamageCoefficient = delayedDamageCoefficient;
}
orig.Invoke(self, overlapAttack);
}
private void FocusedAssaultDash_OnEnter(orig_OnEnter orig, FocusedAssaultDash self)
{
orig.Invoke(self);
if (!scaleDurationWithAttackSpeed)
{
((BasicMeleeAttack)self).duration = ((BasicMeleeAttack)self).baseDuration;
}
}
private void FocusedAssaultPrep_OnEnter(orig_OnEnter orig, FocusedAssaultPrep self)
{
orig.Invoke(self);
if (!scaleDurationWithAttackSpeed)
{
self.duration = self.baseDuration;
}
}
private void Changes()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value)
{
string[] keywordTokens = new string[3] { "KEYWORD_FLEETING", "KEYWORD_STUNNING", "KEYWORD_EXPOSE" };
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyFocusedAssault.asset").WaitForCompletion();
val.keywordTokens = keywordTokens;
}
}
}
internal class LaserSword : TweakBase<LaserSword>
{
public static bool scaleDurationWithAttackSpeed;
public override string Name => "Primary : Laser Sword";
public override string SkillToken => "primary";
public override string DescText => (Main.scaleSomeSkillDamageWithAttackSpeed.Value ? "<style=cIsDamage>Fleeting</style>. " : "") + "<style=cIsUtility>Agile</style>. Slice in front for <style=cIsDamage>130% damage</style>. Every 3rd hit strikes in a greater area and <style=cIsUtility>Exposes</style> enemies.";
public override void Init()
{
scaleDurationWithAttackSpeed = ConfigOption(value: false, "Scale animation speed with Attack Speed?", "Vanilla is true");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
GroundLight2.OnEnter += new hook_OnEnter(GroundLight2_OnEnter);
Changes();
}
private void GroundLight2_OnEnter(orig_OnEnter orig, GroundLight2 self)
{
orig.Invoke(self);
if (!scaleDurationWithAttackSpeed)
{
((BasicMeleeAttack)self).duration = ((BasicMeleeAttack)self).baseDuration;
self.durationBeforeInterruptable = (self.isComboFinisher ? GroundLight2.comboFinisherBaseDurationBeforeInterruptable : GroundLight2.baseDurationBeforeInterruptable);
((BasicMeleeAttack)self).ignoreAttackSpeed = true;
((BasicMeleeAttack)self).scaleHitPauseDurationAndVelocityWithAttackSpeed = false;
}
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value && ((EntityState)self).isAuthority)
{
float damage = ((BasicMeleeAttack)self).overlapAttack.damage + ((BasicMeleeAttack)self).overlapAttack.damage * ((((BaseState)self).attackSpeedStat - 1f) * (((BasicMeleeAttack)self).overlapAttack.damage / 100f));
((BasicMeleeAttack)self).overlapAttack.damage = damage;
}
}
private void Changes()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercGroundLight2.asset").WaitForCompletion();
List<string> list = new List<string>();
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value)
{
list.Add("KEYWORD_FLEETING");
}
list.Add("KEYWORD_AGILE");
list.Add("KEYWORD_EXPOSE");
val.keywordTokens = list.ToArray();
}
}
internal class RisingThunder : TweakBase<RisingThunder>
{
public static bool scaleDurationWithAttackSpeed;
public static float upwardForce;
public static float damageCoefficient;
public static float duration;
public static bool agile;
public override string Name => "Secondary :: Rising Thunder";
public override string SkillToken => "secondary_alt1";
public override string DescText => (Main.scaleSomeSkillDamageWithAttackSpeed.Value ? "<style=cIsDamage>Fleeting</style>. " : "") + (agile ? "<style=cIsUtility>Agile</style>. " : "") + "Unleash a slicing uppercut, dealing <style=cIsDamage>" + d(damageCoefficient) + " damage</style> and sending you airborne.";
public override void Init()
{
scaleDurationWithAttackSpeed = ConfigOption(value: false, "Scale animation speed with Attack Speed?", "Vanilla is true");
upwardForce = ConfigOption(2000f, "Upward Boost Strength", "Vanilla is 3000");
damageCoefficient = ConfigOption(6f, "Damage", "Decimal. Vanilla is 5.5");
duration = ConfigOption(0.25f, "Base Duration", "Vanilla is 0.4");
agile = ConfigOption(value: true, "Agile?", "Vanilla is false");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
Uppercut.OnEnter += new hook_OnEnter(Uppercut_OnEnter);
Uppercut.PlayAnim += new hook_PlayAnim(Uppercut_PlayAnim);
Changes();
}
private void Uppercut_PlayAnim(orig_PlayAnim orig, Uppercut self)
{
Uppercut.baseDuration = duration;
if (!scaleDurationWithAttackSpeed)
{
self.duration = Uppercut.baseDuration;
}
orig.Invoke(self);
}
private void Uppercut_OnEnter(orig_OnEnter orig, Uppercut self)
{
Uppercut.upwardForceStrength = upwardForce;
Uppercut.baseDamageCoefficient = damageCoefficient;
orig.Invoke(self);
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value && ((EntityState)self).isAuthority)
{
float damage = self.overlapAttack.damage + self.overlapAttack.damage * ((((BaseState)self).attackSpeedStat - 1f) * (self.overlapAttack.damage / 432f));
self.overlapAttack.damage = damage;
}
}
private void Changes()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
List<string> list = new List<string>();
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyUppercut.asset").WaitForCompletion();
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value)
{
list.Add("KEYWORD_FLEETING");
}
if (agile)
{
list.Add("KEYWORD_AGILE");
val.cancelSprintingOnActivation = false;
}
val.keywordTokens = list.ToArray();
}
}
public class SlicingWinds : TweakBase<SlicingWinds>
{
public static float damage;
public static bool agile;
public static float scaleMultiplier;
public override string Name => "Special :: Slicing Winds";
public override string SkillToken => "special_alt1";
public override string DescText => (agile ? "<style=cIsUtility>Agile</style>. " : "") + "Fire a wind of blades that attack up to <style=cIsDamage>3</style> enemies for <style=cIsDamage>8x" + d(damage) + " damage</style>. The last hit <style=cIsUtility>Exposes</style> enemies.";
public override void Init()
{
damage = ConfigOption(1f, "Damage", "Decimal. Vanilla is 1");
agile = ConfigOption(value: true, "Agile?", "Vanilla is false");
scaleMultiplier = ConfigOption(2.5f, "Projectile Scale Multiplier", "Makes the projectile easier to hit (as a result, it can get stuck on terrain easier). Vanilla is 1");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ThrowEvisProjectile.OnEnter += new hook_OnEnter(ThrowEvisProjectile_OnEnter);
Changes();
}
private void ThrowEvisProjectile_OnEnter(orig_OnEnter orig, ThrowEvisProjectile self)
{
((GenericProjectileBaseState)self).damageCoefficient = damage;
orig.Invoke(self);
}
private void Changes()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/EvisProjectile.prefab").WaitForCompletion();
val.transform.localScale = Vector3.one * scaleMultiplier;
SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyEvisProjectile.asset").WaitForCompletion();
List<string> list = new List<string>();
if (agile)
{
val2.cancelSprintingOnActivation = false;
list.Add("KEYWORD_AGILE");
}
list.Add("KEYWORD_EXPOSE");
val2.keywordTokens = list.ToArray();
}
}
internal class Whirlwind : TweakBase<Whirlwind>
{
public static bool scaleDurationWithAttackSpeed;
public static bool agile;
public static float groundedSpeedCoefficient;
public static float airborneSpeedCoefficient;
public override string Name => "Secondary : Whirlwind";
public override string SkillToken => "secondary";
public override string DescText => (Main.scaleSomeSkillDamageWithAttackSpeed.Value ? "<style=cIsDamage>Fleeting</style>. " : "") + (agile ? "<style=cIsUtility>Agile</style>. " : "") + "Quickly slice horizontally twice, dealing <style=cIsDamage>2x200% damage</style>. If airborne, slice vertically instead.";
public override void Init()
{
scaleDurationWithAttackSpeed = ConfigOption(value: false, "Scale animation speed with Attack Speed?", "Vanilla is true");
agile = ConfigOption(value: true, "Agile?", "Vanilla is false");
groundedSpeedCoefficient = ConfigOption(6f, "Grounded Speed Coefficient", "Vanilla is 8. This is a compensation for it being Agile and going farther than usual with the default value.");
airborneSpeedCoefficient = ConfigOption(3f, "Airborne Speed Coefficient", "Vanilla is 3.");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
WhirlwindBase.OnEnter += new hook_OnEnter(WhirlwindBase_OnEnter);
WhirlwindAir.PlayAnim += new hook_PlayAnim(WhirlwindAir_PlayAnim);
WhirlwindGround.PlayAnim += new hook_PlayAnim(WhirlwindGround_PlayAnim);
Changes();
}
private void WhirlwindGround_PlayAnim(orig_PlayAnim orig, WhirlwindGround self)
{
((WhirlwindBase)self).moveSpeedBonusCoefficient = groundedSpeedCoefficient;
if (!scaleDurationWithAttackSpeed)
{
((WhirlwindBase)self).duration = ((WhirlwindBase)self).baseDuration;
}
orig.Invoke(self);
}
private void WhirlwindAir_PlayAnim(orig_PlayAnim orig, WhirlwindAir self)
{
((WhirlwindBase)self).moveSpeedBonusCoefficient = airborneSpeedCoefficient;
if (!scaleDurationWithAttackSpeed)
{
((WhirlwindBase)self).duration = ((WhirlwindBase)self).baseDuration;
}
orig.Invoke(self);
}
private void WhirlwindBase_OnEnter(orig_OnEnter orig, WhirlwindBase self)
{
orig.Invoke(self);
if (!scaleDurationWithAttackSpeed)
{
self.duration = self.baseDuration;
self.hitPauseTimer = WhirlwindBase.hitPauseDuration;
}
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value && ((EntityState)self).isAuthority)
{
float damage = self.overlapAttack.damage + self.overlapAttack.damage * ((((BaseState)self).attackSpeedStat - 1f) * (self.overlapAttack.damage / 100f));
self.overlapAttack.damage = damage;
}
}
private void Changes()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
List<string> list = new List<string>();
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyWhirlwind.asset").WaitForCompletion();
if (Main.scaleSomeSkillDamageWithAttackSpeed.Value)
{
list.Add("KEYWORD_FLEETING");
}
if (agile)
{
val.cancelSprintingOnActivation = false;
list.Add("KEYWORD_AGILE");
}
val.keywordTokens = list.ToArray();
}
private void StartingTheCollapseWhirlwind()
{
}
}
}