using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.Captain.Weapon;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.GolemMonster;
using Grumpy;
using JetBrains.Annotations;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using Ultron.Modules;
using Ultron.RobStates;
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 = "")]
[assembly: AssemblyCompany("Ultron")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Ultron")]
[assembly: AssemblyTitle("Ultron")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal class SkillDefInfo
{
public string skillName;
public string skillNameToken;
public string skillDescriptionToken;
public string[] keywordTokens = new string[0];
public Sprite icon;
public SerializableEntityStateType activationState;
public InterruptPriority interruptPriority;
public string activationStateMachineName;
public float baseRechargeInterval;
public int baseMaxStock = 1;
public int rechargeStock = 1;
public int requiredStock = 1;
public int stockToConsume = 1;
public bool isCombatSkill = true;
public bool canceledFromSprinting;
public bool forceSprintDuringState;
public bool cancelSprintingOnActivation = true;
public bool beginSkillCooldownOnSkillEnd;
public bool fullRestockOnAssign = true;
public bool resetCooldownTimerOnUse;
public bool mustKeyPress;
public SkillDefInfo()
{
}
public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval)
{
//IL_0063: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
this.skillName = skillName;
this.skillNameToken = skillNameToken;
this.skillDescriptionToken = skillDescriptionToken;
icon = skillIcon;
this.activationState = activationState;
this.activationStateMachineName = activationStateMachineName;
this.interruptPriority = interruptPriority;
this.isCombatSkill = isCombatSkill;
this.baseRechargeInterval = baseRechargeInterval;
}
public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
{
//IL_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references)
this.skillName = skillName;
this.skillNameToken = skillNameToken;
this.skillDescriptionToken = skillDescriptionToken;
icon = skillIcon;
this.activationState = activationState;
this.activationStateMachineName = activationStateMachineName;
interruptPriority = (InterruptPriority)0;
isCombatSkill = true;
baseRechargeInterval = 0f;
requiredStock = 0;
stockToConsume = 0;
cancelSprintingOnActivation = !agile;
if (agile)
{
keywordTokens = new string[1] { "KEYWORD_AGILE" };
}
}
}
namespace Ultron
{
public class HealOnDestroy : MonoBehaviour, IProjectileImpactBehavior
{
public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
{
TryHeal();
}
private void TryHeal()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
ProjectileController component = ((Component)this).GetComponent<ProjectileController>();
ProjectileDamage component2 = ((Component)this).GetComponent<ProjectileDamage>();
ProjectileImpactExplosion component3 = ((Component)this).GetComponent<ProjectileImpactExplosion>();
if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2) || !Object.op_Implicit((Object)(object)component3) || !Object.op_Implicit((Object)(object)component.owner))
{
return;
}
ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(component.teamFilter.teamIndex);
float num = ((ProjectileExplosion)component3).blastRadius * ((ProjectileExplosion)component3).blastRadius;
for (int i = 0; i < teamMembers.Count; i++)
{
if (!((Object)(object)((Component)teamMembers[i]).gameObject != (Object)(object)component.owner))
{
continue;
}
Vector3 val = ((Component)teamMembers[i]).transform.position - ((Component)this).transform.position;
if (((Vector3)(ref val)).sqrMagnitude <= num)
{
HealthComponent component4 = ((Component)teamMembers[i]).GetComponent<HealthComponent>();
if (Object.op_Implicit((Object)(object)component4))
{
component4.Heal(component2.damage * 0.5f, default(ProcChainMask), true);
}
}
}
}
}
[BepInPlugin("com.rob.Ultron", "Ultron", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
public const string MODUID = "com.rob.Ultron";
public static AssetBundle mainAssetBundle;
internal static Material commandoMat;
public static GameObject ultronBodyPrefab;
public static GameObject ultronDisplayPrefab;
public static GameObject ultronMasterPrefab;
public static SurvivorDef ultronSurvivorDef;
public static GameObject ultOrbProjectile;
public static GameObject zapChargeEffectPrefab;
public static BuffDef ultronSpeedBuff;
private void Awake()
{
//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)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ultron.ultron_bank.bnk"))
{
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
SoundBanks.Add(array);
}
CreateUltronBody();
CreateUltronSurvivor();
CreateProjectile();
CreateEffects();
bool flag = default(bool);
ContentAddition.AddEntityState<Barrage>(ref flag);
bool flag2 = default(bool);
ContentAddition.AddEntityState<Dash>(ref flag2);
bool flag3 = default(bool);
ContentAddition.AddEntityState<FireBeam>(ref flag3);
bool flag4 = default(bool);
ContentAddition.AddEntityState<Zap>(ref flag4);
}
private void CreateEffects()
{
//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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
zapChargeEffectPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ClayBruiser/ChargeClayBruiserMinigun.prefab").WaitForCompletion(), "RobUltronZapChargeEffect", false);
((Component)zapChargeEffectPrefab.transform.Find("FlameTrails, World")).GetComponent<ParticleSystemRenderer>().trailMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matLightningArm.mat").WaitForCompletion();
((Renderer)((Component)zapChargeEffectPrefab.transform.Find("FlameBillboards, Local")).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Loader/matLoaderLightningLarge.mat").WaitForCompletion();
((Component)zapChargeEffectPrefab.transform.Find("SmokeBillboard")).gameObject.SetActive(false);
((Component)zapChargeEffectPrefab.transform.Find("Point Light")).gameObject.SetActive(false);
((Renderer)((Component)zapChargeEffectPrefab.transform.Find("Ring, Dark")).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Teleporters/matTPLunarLightning.mat").WaitForCompletion();
((Component)zapChargeEffectPrefab.transform.Find("FlameTrails, World")).GetComponent<ParticleSystemRenderer>().trailMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matLightningArm.mat").WaitForCompletion();
}
private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)damageInfo.attacker))
{
CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
if (component.baseNameToken == "HEL-P" && Object.op_Implicit((Object)(object)self.body.teamComponent) && Object.op_Implicit((Object)(object)component.teamComponent) && self.body.teamComponent.teamIndex == component.teamComponent.teamIndex)
{
self.Heal(damageInfo.damage, default(ProcChainMask), true);
damageInfo.damage = 0f;
damageInfo.procCoefficient = 0f;
damageInfo.rejected = true;
damageInfo.force = Vector3.zero;
}
}
orig.Invoke(self, damageInfo);
}
public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength)
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)commandoMat))
{
commandoMat = Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial;
}
Material val = Object.Instantiate<Material>(commandoMat);
Material val2 = mainAssetBundle.LoadAsset<Material>(materialName);
if (!Object.op_Implicit((Object)(object)val2))
{
return commandoMat;
}
((Object)val).name = materialName;
val.SetColor("_Color", val2.GetColor("_Color"));
val.SetTexture("_MainTex", val2.GetTexture("_MainTex"));
val.SetColor("_EmColor", emissionColor);
val.SetFloat("_EmPower", emission);
val.SetTexture("_EmTex", val2.GetTexture("_EmissionMap"));
if (normalStrength > 0f)
{
val.SetTexture("_NormalTex", val2.GetTexture("_BumpMap"));
}
val.SetFloat("_NormalStrength", normalStrength);
return val;
}
public static Material CreateMaterial(string materialName)
{
return CreateMaterial(materialName, 0f);
}
public static Material CreateMaterial(string materialName, float emission)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return CreateMaterial(materialName, emission, Color.black);
}
public static Material CreateMaterial(string materialName, float emission, Color emissionColor)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return CreateMaterial(materialName, emission, emissionColor, 0f);
}
private void CreateProjectile()
{
//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_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_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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
ultOrbProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/ToolbotGrenadeLauncherProjectile.prefab").WaitForCompletion(), "RobUltronOrbProjectile", true);
GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/FireballGhost.prefab").WaitForCompletion(), "RobUltronOrbProjectileGhost", false);
((Renderer)((Component)val.transform.Find("Flames")).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/MajorAndMinorConstruct/matMajorConstructBeam.mat").WaitForCompletion();
ultOrbProjectile.GetComponent<ProjectileController>().ghostPrefab = val;
ultOrbProjectile.GetComponent<ProjectileImpactExplosion>().impactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/OmniExplosionVFXMinorConstruct.prefab").WaitForCompletion();
ultOrbProjectile.AddComponent<HealOnDestroy>();
ContentAddition.AddProjectile(ultOrbProjectile);
}
private void CreateUltronBody()
{
//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_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0101: 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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Expected O, but got Unknown
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Expected O, but got Unknown
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0537: Unknown result type (might be due to invalid IL or missing references)
//IL_053c: Unknown result type (might be due to invalid IL or missing references)
//IL_0584: Unknown result type (might be due to invalid IL or missing references)
//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Expected O, but got Unknown
//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_0692: Unknown result type (might be due to invalid IL or missing references)
//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
//IL_06f8: Expected O, but got Unknown
ultronBodyPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/Drone2Body.prefab").WaitForCompletion(), "RobUltronBody", true);
SkillDef skillDef = Skills.CreatePrimarySkillDef(new SerializableEntityStateType(typeof(FireBeam)), "Weapon", "ENCEPHALO-RAY", "UNLEASH A BURNING ENERGY BEAM THAT DEALS <style=cIsDamage>350% DAMAGE</style> AND <style=cIsUtility>EXPLODES</style> AT THE END FOR <style=cIsDamage>500% DAMAGE</style>.", null, agile: false);
CharacterBody component = ultronBodyPrefab.GetComponent<CharacterBody>();
component.baseNameToken = "HEL-P";
component.bodyColor = new Color(0.9490196f, 2f / 51f, 22f / 85f);
component.baseAcceleration = 40f;
component.baseMoveSpeed = 16f;
component.baseMaxHealth = 50f;
component.levelMaxHealth *= 0.2f;
component.baseDamage = 11f;
component.levelDamage = component.baseDamage * 0.2f;
component.baseRegen = 0.5f;
component.levelRegen = component.baseRegen * 0.2f;
component.armor = 0f;
component.bodyFlags = (BodyFlags)16;
component._defaultCrosshairPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/SimpleDotCrosshair.prefab").WaitForCompletion();
component.preferredPodPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/RoboCratePod.prefab").WaitForCompletion();
ultronBodyPrefab.AddComponent<EquipmentSlot>();
SkillLocator component2 = ultronBodyPrefab.GetComponent<SkillLocator>();
component2.passiveSkill.enabled = true;
component2.passiveSkill.skillNameToken = "DYNAMIC FLIGHT";
component2.passiveSkill.skillDescriptionToken = "HEL-P IS ABLE TO <style=cIsUtility>FLY FREELY</style>, BUT IS <style=cIsHealth>EXTREMELY FRAGILE</style>.";
GenericSkill[] components = ultronBodyPrefab.GetComponents<GenericSkill>();
foreach (GenericSkill val in components)
{
Object.Destroy((Object)(object)val);
}
GenericSkill val2 = ultronBodyPrefab.AddComponent<GenericSkill>();
SkillFamily val3 = new SkillFamily();
val3.catalogIndex = 0;
val3.defaultVariantIndex = 0u;
SkillFamily obj = val3;
Variant[] array = new Variant[1];
Variant val4 = new Variant
{
skillDef = skillDef,
unlockableDef = null
};
((Variant)(ref val4)).viewableNode = null;
array[0] = val4;
obj.variants = (Variant[])(object)array;
SkillFamily val5 = (val2._skillFamily = val3);
val2.skillName = "UltronPrimary";
val2.hideInCharacterSelect = false;
ultronBodyPrefab.GetComponent<SkillLocator>().primary = val2;
ContentAddition.AddSkillFamily(val5);
SkillDefInfo skillDefInfo = new SkillDefInfo();
skillDefInfo.skillName = "UltronZap";
skillDefInfo.skillNameToken = "IMPERATIVE: NEUTRALIZE";
skillDefInfo.skillDescriptionToken = "ZAP A HOSTILE COMBATANT TO <style=cIsUtility>SHOCK</style> THEM FOR <style=cIsDamage>30%</style> DAMAGE. <style=cIsUtility>HOLD UP TO 2 CHARGES.</style>";
skillDefInfo.icon = null;
skillDefInfo.activationState = new SerializableEntityStateType(typeof(Zap));
skillDefInfo.activationStateMachineName = "Weapon";
skillDefInfo.baseMaxStock = 2;
skillDefInfo.baseRechargeInterval = 5f;
skillDefInfo.beginSkillCooldownOnSkillEnd = true;
skillDefInfo.canceledFromSprinting = false;
skillDefInfo.forceSprintDuringState = false;
skillDefInfo.fullRestockOnAssign = true;
skillDefInfo.interruptPriority = (InterruptPriority)1;
skillDefInfo.resetCooldownTimerOnUse = false;
skillDefInfo.isCombatSkill = true;
skillDefInfo.mustKeyPress = true;
skillDefInfo.cancelSprintingOnActivation = false;
skillDefInfo.rechargeStock = 1;
skillDefInfo.requiredStock = 1;
skillDefInfo.stockToConsume = 1;
SkillDef skillDef2 = Skills.CreateSkillDef(skillDefInfo);
GenericSkill val6 = ultronBodyPrefab.AddComponent<GenericSkill>();
val3 = new SkillFamily();
val3.catalogIndex = 0;
val3.defaultVariantIndex = 0u;
SkillFamily obj2 = val3;
Variant[] array2 = new Variant[1];
val4 = new Variant
{
skillDef = skillDef2,
unlockableDef = null
};
((Variant)(ref val4)).viewableNode = null;
array2[0] = val4;
obj2.variants = (Variant[])(object)array2;
val5 = val3;
val6._skillFamily = val5;
val6.skillName = "Ultrons";
val6.hideInCharacterSelect = false;
ultronBodyPrefab.GetComponent<SkillLocator>().secondary = val6;
skillDefInfo = new SkillDefInfo();
skillDefInfo.skillName = "UltronDash";
skillDefInfo.skillNameToken = "IMPERATIVE: FLEE";
skillDefInfo.skillDescriptionToken = "DASH, GAINING <style=cIsHealing>25% BARRIER</style>, AND THEN ENTER AN <style=cIsUtility>ACCELERATED</style> STATE FOR THE NEXT <style=cIsDamage>7 SECONDS</style>.";
skillDefInfo.icon = null;
skillDefInfo.activationState = new SerializableEntityStateType(typeof(Dash));
skillDefInfo.activationStateMachineName = "Weapon";
skillDefInfo.baseMaxStock = 1;
skillDefInfo.baseRechargeInterval = 12f;
skillDefInfo.beginSkillCooldownOnSkillEnd = true;
skillDefInfo.canceledFromSprinting = false;
skillDefInfo.forceSprintDuringState = false;
skillDefInfo.fullRestockOnAssign = true;
skillDefInfo.interruptPriority = (InterruptPriority)2;
skillDefInfo.resetCooldownTimerOnUse = false;
skillDefInfo.isCombatSkill = false;
skillDefInfo.mustKeyPress = true;
skillDefInfo.cancelSprintingOnActivation = false;
skillDefInfo.rechargeStock = 1;
skillDefInfo.requiredStock = 1;
skillDefInfo.stockToConsume = 1;
SkillDef skillDef3 = Skills.CreateSkillDef(skillDefInfo);
GenericSkill val7 = ultronBodyPrefab.AddComponent<GenericSkill>();
val3 = new SkillFamily();
val3.catalogIndex = 0;
val3.defaultVariantIndex = 0u;
SkillFamily obj3 = val3;
Variant[] array3 = new Variant[1];
val4 = new Variant
{
skillDef = skillDef3,
unlockableDef = null
};
((Variant)(ref val4)).viewableNode = null;
array3[0] = val4;
obj3.variants = (Variant[])(object)array3;
val5 = (val7._skillFamily = val3);
val7.skillName = "UltronUtility";
val7.hideInCharacterSelect = false;
ultronBodyPrefab.GetComponent<SkillLocator>().utility = val7;
ContentAddition.AddSkillFamily(val5);
skillDefInfo = new SkillDefInfo();
skillDefInfo.skillName = "UltronBarrage";
skillDefInfo.skillNameToken = "IMPERATIVE: EXTERMINATE";
skillDefInfo.skillDescriptionToken = "FIRE A BARRAGE OF ENERGY THAT <style=cIsHealth>HARMS HOSTILE COMBATANTS</style> AND <style=cIsHealing>HEALS FRIENDLY COMBATANTS</style> FOR <style=cIsDamage>5x300%</style>. <style=cIsUtility>HOLD UP TO 3 CHARGES.</style>";
skillDefInfo.icon = null;
skillDefInfo.activationState = new SerializableEntityStateType(typeof(Barrage));
skillDefInfo.activationStateMachineName = "Weapon";
skillDefInfo.baseMaxStock = 3;
skillDefInfo.baseRechargeInterval = 10f;
skillDefInfo.beginSkillCooldownOnSkillEnd = false;
skillDefInfo.canceledFromSprinting = false;
skillDefInfo.forceSprintDuringState = false;
skillDefInfo.fullRestockOnAssign = true;
skillDefInfo.interruptPriority = (InterruptPriority)1;
skillDefInfo.resetCooldownTimerOnUse = false;
skillDefInfo.isCombatSkill = true;
skillDefInfo.mustKeyPress = false;
skillDefInfo.cancelSprintingOnActivation = false;
skillDefInfo.rechargeStock = 1;
skillDefInfo.requiredStock = 1;
skillDefInfo.stockToConsume = 1;
SkillDef skillDef4 = Skills.CreateSkillDef(skillDefInfo);
GenericSkill val8 = ultronBodyPrefab.AddComponent<GenericSkill>();
val3 = new SkillFamily();
val3.catalogIndex = 0;
val3.defaultVariantIndex = 0u;
SkillFamily obj4 = val3;
Variant[] array4 = new Variant[1];
val4 = new Variant
{
skillDef = skillDef4,
unlockableDef = null
};
((Variant)(ref val4)).viewableNode = null;
array4[0] = val4;
obj4.variants = (Variant[])(object)array4;
val5 = val3;
val8._skillFamily = val5;
val8.skillName = "Ultronu";
val8.hideInCharacterSelect = false;
ultronBodyPrefab.GetComponent<SkillLocator>().special = val8;
ContentAddition.AddBody(ultronBodyPrefab);
ultronDisplayPrefab = PrefabAPI.InstantiateClone(((Component)ultronBodyPrefab.transform.GetChild(0)).gameObject, "RobUltronDisplay", true);
ultronMasterPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/Drone2Master.prefab").WaitForCompletion(), "RobUltronMonsterMaster", true);
CharacterMaster component3 = ultronMasterPrefab.GetComponent<CharacterMaster>();
component3.bodyPrefab = ultronBodyPrefab;
ContentAddition.AddMaster(ultronMasterPrefab);
ultronSpeedBuff = AddNewBuff("bdUltronSpeed", null, component.bodyColor, canStack: false, isDebuff: false);
CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
}
private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
{
orig.Invoke(self);
if (Object.op_Implicit((Object)(object)self) && self.HasBuff(ultronSpeedBuff))
{
self.moveSpeed += 8f;
}
}
internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, bool isHidden = false)
{
//IL_0010: 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)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = buffName;
val.buffColor = buffColor;
val.canStack = canStack;
val.isDebuff = isDebuff;
val.eliteDef = null;
val.iconSprite = buffIcon;
val.isHidden = isHidden;
ContentAddition.AddBuffDef(val);
return val;
}
private void CreateUltronSurvivor()
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
ultronSurvivorDef = ScriptableObject.CreateInstance<SurvivorDef>();
ultronSurvivorDef.bodyPrefab = ultronBodyPrefab;
ultronSurvivorDef.displayPrefab = ultronDisplayPrefab;
ultronSurvivorDef.displayNameToken = "HEL-P";
ultronSurvivorDef.descriptionToken = "";
ultronSurvivorDef.outroFlavorToken = "..and so he left.";
ultronSurvivorDef.mainEndingEscapeFailureFlavorToken = "..and so he vanished.";
ultronSurvivorDef.desiredSortPosition = 1f;
ultronSurvivorDef.unlockableDef = null;
ultronSurvivorDef.cachedName = "Ultron";
ultronSurvivorDef.primaryColor = new Color(29f / 51f, 0f, 1f);
ultronSurvivorDef.hidden = false;
ContentAddition.AddSurvivorDef(ultronSurvivorDef);
}
private static RendererInfo[] SkinRendererInfos(RendererInfo[] defaultRenderers, Material[] materials)
{
RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[defaultRenderers.Length];
defaultRenderers.CopyTo(array, 0);
for (int i = 0; i < materials.Length; i++)
{
if (Object.op_Implicit((Object)(object)materials[i]))
{
array[i].defaultMaterial = materials[i];
}
}
return array;
}
}
public class UltronTracker : MonoBehaviour
{
public float maxTrackingDistance = 50f;
public float maxTrackingAngle = 20f;
public float trackerUpdateFrequency = 10f;
private HurtBox trackingTarget;
private TeamComponent teamComponent;
private InputBankTest inputBank;
private float trackerUpdateStopwatch;
private Indicator indicator;
private readonly BullseyeSearch search = new BullseyeSearch();
private void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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: Expected O, but got Unknown
indicator = new Indicator(((Component)this).gameObject, Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Huntress/HuntressTrackingIndicator.prefab").WaitForCompletion());
}
private void Start()
{
inputBank = ((Component)this).GetComponent<InputBankTest>();
teamComponent = ((Component)this).GetComponent<TeamComponent>();
}
public HurtBox GetTrackingTarget()
{
return trackingTarget;
}
private void OnEnable()
{
indicator.active = true;
}
private void OnDisable()
{
indicator.active = false;
}
private void OnDestroy()
{
indicator.active = false;
}
private void FixedUpdate()
{
//IL_0050: 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_0066: Unknown result type (might be due to invalid IL or missing references)
trackerUpdateStopwatch += Time.fixedDeltaTime;
if (trackerUpdateStopwatch >= 1f / trackerUpdateFrequency)
{
trackerUpdateStopwatch -= 1f / trackerUpdateFrequency;
Ray aimRay = default(Ray);
((Ray)(ref aimRay))..ctor(inputBank.aimOrigin, inputBank.aimDirection);
SearchForTarget(aimRay);
indicator.targetTransform = (Object.op_Implicit((Object)(object)trackingTarget) ? ((Component)trackingTarget).transform : null);
}
}
private void SearchForTarget(Ray aimRay)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
search.teamMaskFilter = TeamMask.GetUnprotectedTeams(teamComponent.teamIndex);
search.filterByLoS = true;
search.searchOrigin = ((Ray)(ref aimRay)).origin;
search.searchDirection = ((Ray)(ref aimRay)).direction;
search.sortMode = (SortMode)1;
search.maxDistanceFilter = maxTrackingDistance;
search.maxAngleFilter = maxTrackingAngle;
search.RefreshCandidates();
search.FilterOutGameObject(((Component)this).gameObject);
trackingTarget = search.GetResults().FirstOrDefault();
}
}
public class UltronTrackingSkillDef : SkillDef
{
protected class InstanceData : BaseSkillInstanceData
{
public UltronTracker tracker;
}
public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
{
return (BaseSkillInstanceData)(object)new InstanceData
{
tracker = ((Component)skillSlot).GetComponent<UltronTracker>()
};
}
private static bool HasTarget([NotNull] GenericSkill skillSlot)
{
UltronTracker tracker = ((InstanceData)(object)skillSlot.skillInstanceData).tracker;
return Object.op_Implicit((Object)(object)(((Object)(object)tracker != (Object)null) ? tracker.GetTrackingTarget() : null));
}
public override bool CanExecute([NotNull] GenericSkill skillSlot)
{
return HasTarget(skillSlot) && ((SkillDef)this).CanExecute(skillSlot);
}
public override bool IsReady([NotNull] GenericSkill skillSlot)
{
return ((SkillDef)this).IsReady(skillSlot) && HasTarget(skillSlot);
}
}
}
namespace Ultron.RobStates
{
public class Barrage : BaseSkillState
{
public float baseDuration = 1f;
public float damageCoefficient = 3f;
private float duration;
private bool fired1;
private bool fired2;
private bool fired3;
private bool fired4;
public override void OnEnter()
{
((BaseState)this).OnEnter();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
FireOrb();
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddBuff(Buffs.Slow50);
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
if (NetworkServer.active)
{
((EntityState)this).characterBody.RemoveBuff(Buffs.Slow50);
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).fixedAge >= 0.15f * duration && !fired1)
{
fired1 = true;
FireOrb();
}
if ((double)((EntityState)this).fixedAge >= 0.3 * (double)duration && !fired2)
{
fired2 = true;
FireOrb();
}
if (((EntityState)this).fixedAge >= 0.45f * duration && !fired3)
{
fired3 = true;
FireOrb();
}
if ((double)((EntityState)this).fixedAge >= 0.6 * (double)duration && !fired4)
{
fired4 = true;
FireOrb();
}
if (((EntityState)this).fixedAge >= 0.5f + duration)
{
Util.PlaySound("sfx_ultron_reload", ((EntityState)this).gameObject);
if (((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
}
private void FireOrb()
{
//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_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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
Util.PlaySound("sfx_ultron_ult_fire", ((EntityState)this).gameObject);
((EntityState)this).characterBody.AddSpreadBloom(4f);
EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/MuzzleflashSmokeRing.prefab").WaitForCompletion(), ((EntityState)this).gameObject, "Muzzle", false);
if (((EntityState)this).isAuthority)
{
float num = 5f / ((BaseState)this).attackSpeedStat;
((BaseState)this).AddRecoil(-0.4f * num, -0.8f * num, -0.3f * num, 0.3f * num);
Ray aimRay = ((BaseState)this).GetAimRay();
ProjectileManager.instance.FireProjectile(Plugin.ultOrbProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * damageCoefficient, 500f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, 150f, (DamageTypeCombo?)null);
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_001b: 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_001e: Unknown result type (might be due to invalid IL or missing references)
if (((EntityState)this).fixedAge >= duration)
{
return (InterruptPriority)0;
}
return (InterruptPriority)2;
}
}
public class Dash : BaseSkillState
{
public float baseDuration = 0.15f;
protected Vector3 slipVector = Vector3.zero;
public float duration = 0.15f;
public override void OnEnter()
{
//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_003f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
((BaseState)this).OnEnter();
duration = baseDuration;
Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
slipVector = ((Vector3)(ref val)).normalized;
ApplyBuff();
CreateDashEffect();
Util.PlaySound("sfx_ultron_dash", ((EntityState)this).gameObject);
}
public virtual void ApplyBuff()
{
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, duration);
((EntityState)this).characterBody.AddTimedBuff(Plugin.ultronSpeedBuff, 7f);
}
if (((EntityState)this).isAuthority)
{
((EntityState)this).healthComponent.AddBarrierAuthority(0.25f * ((EntityState)this).healthComponent.fullBarrier);
}
}
public virtual void CreateDashEffect()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
float num = 3f;
if (((EntityState)this).isAuthority)
{
((BaseState)this).AddRecoil(-1f * num, -2f * num, -0.5f * num, 0.5f * num);
}
EffectData val = new EffectData();
val.rotation = Util.QuaternionSafeLookRotation(slipVector);
val.origin = ((EntityState)this).transform.position;
EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BoostJumpEffect"), val, false);
}
public override void FixedUpdate()
{
//IL_000f: 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_002e: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
((EntityState)this).rigidbody.velocity = slipVector * ((BaseState)this).moveSpeedStat * 200f * Time.fixedDeltaTime;
if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public virtual void DampenVelocity()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
Rigidbody rigidbody = ((EntityState)this).rigidbody;
rigidbody.velocity *= 0.54f;
}
public override void OnExit()
{
DampenVelocity();
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)5;
}
}
public class FireBeam : BaseSkillState
{
private enum SubState
{
Beam,
Blast
}
public float maxDistance = 150f;
public float baseBeamDuration = 0.5f;
public float baseBlastDuration = 0.7f;
public float beamDamageCoefficient = 3.5f;
public float blastDamageCoefficient = 5f;
public float beamProcCoefficient = 0.75f;
public float blastProcCoefficient = 1f;
public float blastRadius = 8f;
public float maxWidth = 1.75f;
public float minSpreadBloom = 0f;
public float maxSpreadBloom = 1f;
private float beamDuration;
private float blastDuration;
private SubState subState;
private float stopwatch;
private float beamTickStopwatch;
private bool firedBlast;
private GameObject beamEffectInstance;
private LineRenderer beamLine;
private Ray storedAimRay;
public override void OnEnter()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
((EntityState)this).characterBody.SetAimTimer(2f);
beamDuration = baseBeamDuration / ((BaseState)this).attackSpeedStat;
blastDuration = baseBlastDuration / ((BaseState)this).attackSpeedStat;
Util.PlayAttackSpeedSound("sfx_ultron_beam", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
beamEffectInstance = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/LaserMajorConstruct.prefab").WaitForCompletion());
beamEffectInstance.transform.SetParent(((EntityState)this).characterBody.aimOriginTransform, false);
beamEffectInstance.transform.localPosition = Vector3.zero;
Transform obj = beamEffectInstance.transform.Find("LaserStart");
obj.localScale *= 0.25f;
((Component)beamEffectInstance.transform.Find("LaserStart/Fire, Electric")).gameObject.SetActive(false);
Transform obj2 = beamEffectInstance.transform.Find("LaserStart/SoftGlowFlash");
obj2.localScale *= 0.25f;
Transform obj3 = beamEffectInstance.transform.Find("LaserStart/Hexagon");
obj3.localScale *= 0.25f;
Transform obj4 = beamEffectInstance.transform.Find("LaserStart/Flare (1)");
obj4.localScale *= 0.25f;
((Component)beamEffectInstance.transform.Find("LaserEnd/PP")).gameObject.SetActive(false);
Transform obj5 = beamEffectInstance.transform.Find("LaserEnd/SoftGlowFlash");
obj5.localScale *= 0.25f;
Transform obj6 = beamEffectInstance.transform.Find("LaserEnd/Flare");
obj6.localScale *= 0.5f;
Transform obj7 = beamEffectInstance.transform.Find("LaserEnd/LightShafts");
obj7.localScale *= 0.5f;
Transform obj8 = beamEffectInstance.transform.Find("LaserEnd/SoftGlowFlash");
obj8.localScale *= 0.25f;
((Component)beamEffectInstance.transform.Find("LaserEnd/Debris")).gameObject.SetActive(false);
((Component)beamEffectInstance.transform.Find("LaserEnd/Point light")).GetComponent<Light>().range = 2.5f;
beamLine = beamEffectInstance.GetComponentInChildren<LineRenderer>();
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddBuff(Buffs.Slow50);
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
if (Object.op_Implicit((Object)(object)beamEffectInstance))
{
EntityState.Destroy((Object)(object)beamEffectInstance);
}
if (NetworkServer.active)
{
((EntityState)this).characterBody.RemoveBuff(Buffs.Slow50);
}
}
public override void FixedUpdate()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (subState == SubState.Beam)
{
beamTickStopwatch -= Time.fixedDeltaTime;
if (beamTickStopwatch <= 0f)
{
FireLazer();
}
if (Object.op_Implicit((Object)(object)beamEffectInstance))
{
Ray aimRay = ((BaseState)this).GetAimRay();
((Ray)(ref storedAimRay)).origin = ((Ray)(ref aimRay)).origin;
((Ray)(ref storedAimRay)).direction = Vector3.Lerp(((Ray)(ref storedAimRay)).direction, ((Ray)(ref aimRay)).direction, Time.fixedDeltaTime * 60f);
beamEffectInstance.transform.position = ((BaseState)this).FindModelChild("Muzzle").position;
Vector3 val = ((Ray)(ref storedAimRay)).origin + ((Ray)(ref storedAimRay)).direction * maxDistance;
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(storedAimRay, ref val2, maxDistance, LayerMask.op_Implicit(CommonMasks.laser)))
{
val = ((RaycastHit)(ref val2)).point;
}
Vector3 position = Vector3.Lerp(((Component)beamEffectInstance.GetComponent<ChildLocator>().FindChild("LaserEnd")).transform.position, val, Time.fixedDeltaTime * 60f);
((Component)beamEffectInstance.GetComponent<ChildLocator>().FindChild("LaserEnd")).transform.position = position;
beamLine.widthMultiplier = Util.Remap(stopwatch, 0f, beamDuration, maxWidth, 0.1f);
}
((EntityState)this).characterBody.SetSpreadBloom(Util.Remap(stopwatch, 0f, beamDuration, minSpreadBloom, maxSpreadBloom), false);
if (stopwatch >= beamDuration)
{
stopwatch = 0f;
subState = SubState.Blast;
EntityState.Destroy((Object)(object)beamEffectInstance);
}
}
else if (subState == SubState.Blast)
{
if (!firedBlast)
{
firedBlast = true;
FireBlast();
}
if (stopwatch >= blastDuration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
}
private void FireBlast()
{
//IL_0051: 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_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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Expected O, but got Unknown
Util.PlaySound("sfx_ultron_blast", ((EntityState)this).gameObject);
if (((EntityState)this).isAuthority)
{
float num = 5f / ((BaseState)this).attackSpeedStat;
((BaseState)this).AddRecoil(-0.4f * num, -0.8f * num, -0.3f * num, 0.3f * num);
Ray aimRay = ((BaseState)this).GetAimRay();
((Ray)(ref aimRay)).origin = ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction;
Vector3 val = ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * maxDistance;
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(aimRay, ref val2, maxDistance, LayerMask.op_Implicit(CommonMasks.laser)))
{
val = ((RaycastHit)(ref val2)).point;
}
new BlastAttack
{
attacker = ((EntityState)this).gameObject,
inflictor = ((EntityState)this).gameObject,
teamIndex = ((BaseState)this).GetTeam(),
baseDamage = ((BaseState)this).damageStat * blastDamageCoefficient,
damageType = DamageTypeCombo.GenericPrimary,
baseForce = 250f,
position = val,
radius = blastRadius,
falloffModel = (FalloffModel)2,
bonusForce = 500f * ((Ray)(ref aimRay)).direction
}.Fire();
if (Object.op_Implicit((Object)(object)FireLaser.tracerEffectPrefab))
{
EffectData val3 = new EffectData
{
origin = val,
start = ((Ray)(ref aimRay)).origin
};
val3.SetChildLocatorTransformReference(((EntityState)this).gameObject, ((EntityState)this).GetModelChildLocator().FindChildIndex("Muzzle"));
EffectManager.SpawnEffect(FireLaser.tracerEffectPrefab, val3, true);
EffectManager.SpawnEffect(FireLaser.hitEffectPrefab, val3, true);
}
}
((EntityState)this).characterBody.AddSpreadBloom(4f);
}
private void FireLazer()
{
//IL_0022: 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_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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_008e: 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_009b: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
beamTickStopwatch = beamDuration / 8f;
if (((EntityState)this).isAuthority)
{
Ray aimRay = ((BaseState)this).GetAimRay();
new BulletAttack
{
owner = ((EntityState)this).gameObject,
weapon = ((EntityState)this).gameObject,
origin = ((Ray)(ref aimRay)).origin,
aimVector = ((Ray)(ref aimRay)).direction,
muzzleName = "Muzzle",
maxDistance = maxDistance,
minSpread = 0f,
maxSpread = 0f,
radius = 0.25f,
falloffModel = (FalloffModel)1,
smartCollision = true,
stopperMask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
hitMask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
damage = beamDamageCoefficient * ((BaseState)this).damageStat * 0.125f,
procCoefficient = beamProcCoefficient,
force = 5f,
isCrit = ((BaseState)this).RollCrit(),
hitEffectPrefab = FireBarrage.hitEffectPrefab
}.Fire();
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)1;
}
}
public class Zap : BaseSkillState
{
public float baseDuration = 1f;
public float damageCoefficient = 0.3f;
private float duration;
private bool hasFired;
private GameObject chargeInstance;
private EffectManagerHelper _emh_chargeInstance;
public override void OnEnter()
{
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
Util.PlayAttackSpeedSound("sfx_ultron_ult_prep", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
Transform modelTransform = ((EntityState)this).GetModelTransform();
if (Object.op_Implicit((Object)(object)modelTransform))
{
ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)component))
{
Transform val = component.FindChild("Muzzle");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)Plugin.zapChargeEffectPrefab))
{
if (!EffectManager.ShouldUsePooledEffect(Plugin.zapChargeEffectPrefab))
{
chargeInstance = Object.Instantiate<GameObject>(Plugin.zapChargeEffectPrefab, val.position, val.rotation);
}
else
{
_emh_chargeInstance = EffectManager.GetAndActivatePooledEffect(Plugin.zapChargeEffectPrefab, val.position, val.rotation);
chargeInstance = ((Component)_emh_chargeInstance).gameObject;
}
chargeInstance.transform.parent = val;
ScaleParticleSystemDuration component2 = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.newDuration = duration * 0.7f;
}
}
}
}
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddBuff(Buffs.Slow50);
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
if (NetworkServer.active)
{
((EntityState)this).characterBody.RemoveBuff(Buffs.Slow50);
}
if (Object.op_Implicit((Object)(object)chargeInstance))
{
if ((Object)(object)_emh_chargeInstance != (Object)null && _emh_chargeInstance.OwningPool != null)
{
((GenericPool<EffectManagerHelper>)(object)_emh_chargeInstance.OwningPool).ReturnObject(_emh_chargeInstance);
}
else
{
EntityState.Destroy((Object)(object)chargeInstance);
}
chargeInstance = null;
_emh_chargeInstance = null;
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).fixedAge >= 0.7f * duration && !hasFired)
{
if (Object.op_Implicit((Object)(object)chargeInstance))
{
if ((Object)(object)_emh_chargeInstance != (Object)null && _emh_chargeInstance.OwningPool != null)
{
((GenericPool<EffectManagerHelper>)(object)_emh_chargeInstance.OwningPool).ReturnObject(_emh_chargeInstance);
}
else
{
EntityState.Destroy((Object)(object)chargeInstance);
}
chargeInstance = null;
_emh_chargeInstance = null;
}
hasFired = true;
FireOrb();
}
if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
private void FireOrb()
{
//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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).characterBody.AddSpreadBloom(4f);
EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/MuzzleflashLunarGolemTwinShot.prefab").WaitForCompletion(), ((EntityState)this).gameObject, "Muzzle", false);
if (((EntityState)this).isAuthority)
{
float num = 5f / ((BaseState)this).attackSpeedStat;
((BaseState)this).AddRecoil(-0.4f * num, -0.8f * num, -0.3f * num, 0.3f * num);
Ray aimRay = ((BaseState)this).GetAimRay();
ProjectileManager.instance.FireProjectile(FireTazer.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * damageCoefficient, 0f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, 80f, (DamageTypeCombo?)null);
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
}
}
namespace Ultron.Modules
{
internal static class Skills
{
internal static List<SkillFamily> skillFamilies = new List<SkillFamily>();
internal static List<SkillDef> skillDefs = new List<SkillDef>();
public static void CreateSkillFamilies(GameObject targetPrefab, int families = 15, bool destroyExisting = true)
{
if (destroyExisting)
{
GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
foreach (GenericSkill val in componentsInChildren)
{
Object.DestroyImmediate((Object)(object)val);
}
}
SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
if (((uint)families & (true ? 1u : 0u)) != 0)
{
component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
}
if (((uint)families & 2u) != 0)
{
component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
}
if (((uint)families & 4u) != 0)
{
component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
}
if (((uint)families & 8u) != 0)
{
component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
}
}
public static void KillSkillFamilies(GameObject targetPrefab)
{
GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
foreach (GenericSkill val in componentsInChildren)
{
Object.DestroyImmediate((Object)(object)val);
}
}
public static void CreateSkillFamilies2(GameObject targetPrefab, int families = 15, bool destroyExisting = true)
{
SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
if (((uint)families & (true ? 1u : 0u)) != 0)
{
component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
}
if (((uint)families & 2u) != 0)
{
component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
}
if (((uint)families & 4u) != 0)
{
component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
}
if (((uint)families & 8u) != 0)
{
component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
}
}
public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false)
{
GenericSkill val = targetPrefab.AddComponent<GenericSkill>();
val.skillName = familyName;
val.hideInCharacterSelect = hidden;
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family";
val2.variants = (Variant[])(object)new Variant[0];
val._skillFamily = val2;
skillFamilies.Add(val2);
return val;
}
public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null)
{
//IL_0029: 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_0053: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val = new Variant
{
skillDef = skillDef,
unlockableDef = unlockableDef
};
((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
variants[num] = val;
}
public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs)
{
foreach (SkillDef skillDef in skillDefs)
{
AddSkillToFamily(skillFamily, skillDef);
}
}
public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs);
}
public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs);
}
public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs);
}
public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs)
{
AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs);
}
public static void AddPassiveSkills(SkillFamily passiveSkillFamily, params SkillDef[] skillDefs)
{
AddSkillsToFamily(passiveSkillFamily, skillDefs);
}
public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < unlockableDefs.Length; i++)
{
Variant val = skillFamily.variants[i];
val.unlockableDef = unlockableDefs[i];
skillFamily.variants[i] = val;
}
}
public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo)
{
return Skills.CreateSkillDef<SkillDef>(skillDefInfo);
}
public static UltronTrackingSkillDef CreateTrackingSkillDef(SkillDefInfo skillDefInfo)
{
return CreateSkillDef<UltronTrackingSkillDef>(skillDefInfo);
}
public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef
{
T val = ScriptableObject.CreateInstance<T>();
popuplateSKillDef(skillDefInfo, (SkillDef)(object)val);
skillDefs.Add((SkillDef)(object)val);
return val;
}
private static void popuplateSKillDef(SkillDefInfo skillDefInfo, SkillDef skillDef)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
skillDef.skillName = skillDefInfo.skillName;
((Object)skillDef).name = skillDefInfo.skillName;
skillDef.skillNameToken = skillDefInfo.skillNameToken;
skillDef.skillDescriptionToken = skillDefInfo.skillDescriptionToken;
skillDef.icon = skillDefInfo.icon;
skillDef.activationState = skillDefInfo.activationState;
skillDef.activationStateMachineName = skillDefInfo.activationStateMachineName;
skillDef.baseMaxStock = skillDefInfo.baseMaxStock;
skillDef.baseRechargeInterval = skillDefInfo.baseRechargeInterval;
skillDef.beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd;
skillDef.canceledFromSprinting = skillDefInfo.canceledFromSprinting;
skillDef.forceSprintDuringState = skillDefInfo.forceSprintDuringState;
skillDef.fullRestockOnAssign = skillDefInfo.fullRestockOnAssign;
skillDef.interruptPriority = skillDefInfo.interruptPriority;
skillDef.resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse;
skillDef.isCombatSkill = skillDefInfo.isCombatSkill;
skillDef.mustKeyPress = skillDefInfo.mustKeyPress;
skillDef.cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation;
skillDef.rechargeStock = skillDefInfo.rechargeStock;
skillDef.requiredStock = skillDefInfo.requiredStock;
skillDef.stockToConsume = skillDefInfo.stockToConsume;
skillDef.keywordTokens = skillDefInfo.keywordTokens;
}
internal static SkillDef CreatePrimarySkillDef(SerializableEntityStateType state, string stateMachine, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, bool agile)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
SkillDefInfo skillDefInfo = new SkillDefInfo(skillNameToken, skillNameToken, skillDescriptionToken, skillIcon, state, stateMachine, agile);
return CreateSkillDef(skillDefInfo);
}
}
}