using System;
using System.Collections;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.UI;
using Waffle.Revenant.States;
[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Waffle.Revenant")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f7379d39c70455b4a3f7d8063f5960986278abf8")]
[assembly: AssemblyProduct("Waffle.Revenant")]
[assembly: AssemblyTitle("Waffle.Revenant")]
[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 Waffle.Revenant
{
public class BounceProjectile : MonoBehaviour
{
public int AmountOfBounces;
public GameObject KeepNonRotated;
private int _timesBounced;
public bool HasBouncesLeft()
{
return _timesBounced++ <= AmountOfBounces;
}
}
public class CallOnOtherObjectsDestroyed : MonoBehaviour
{
public GameObject[] DependantObjects;
public UltrakillEvent Event;
public void Update()
{
bool flag = true;
GameObject[] dependantObjects = DependantObjects;
foreach (GameObject val in dependantObjects)
{
flag = flag && (Object)(object)val == (Object)null;
}
if (flag)
{
Event.Invoke();
}
}
}
public class IndestructableProjectile : MonoBehaviour
{
}
public class JumpscareCanvas : MonoBehaviour
{
private static JumpscareCanvas _instance;
public Image Image;
public Image Crt;
public GameObject Tendrils;
public Image[] TendrilImages;
public AudioSource GlitchSound;
public Vector2 PitchRange;
private Coroutine _lastFlash;
private static Material _noise;
public static JumpscareCanvas Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.Instantiate<GameObject>(RevenantAssets.Instance.TemplateJumpscareCanvas).GetComponent<JumpscareCanvas>();
}
return _instance;
}
}
public static Material Noise
{
get
{
if ((Object)(object)_noise == (Object)null)
{
CreateNoiseMaker();
}
return _noise;
}
}
public static void CreateNoiseMaker()
{
//IL_007f: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
Camera val = (from x in ((Component)((Component)MonoSingleton<CameraController>.Instance).transform).GetComponentsInChildren<Camera>(true)
where ((Object)x).name == "Virtual Camera"
select x).FirstOrDefault();
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"No virtual cam!");
return;
}
MeshRenderer componentInChildren = ((Component)val).GetComponentInChildren<MeshRenderer>(true);
GameObject val2 = Object.Instantiate<GameObject>(((Component)componentInChildren).gameObject, ((Component)val).transform);
val2.transform.localScale = ((Component)componentInChildren).transform.localScale;
val2.transform.localRotation = ((Component)componentInChildren).transform.localRotation;
val2.transform.localPosition = ((Component)componentInChildren).transform.localPosition + new Vector3(0f, 0f, -0.015f);
MeshRenderer component = val2.GetComponent<MeshRenderer>();
((Renderer)component).material = RevenantAssets.Instance.NoiseMaterial;
_noise = ((Renderer)component).material;
}
private void Start()
{
((Component)Image).gameObject.SetActive(false);
Tendrils.gameObject.SetActive(false);
}
public void FlashImage(Revenant rev)
{
if (rev.JumpscaresEnabled)
{
if (_lastFlash != null)
{
((MonoBehaviour)this).StopCoroutine(_lastFlash);
}
_lastFlash = ((MonoBehaviour)this).StartCoroutine(FlashImageRoutine(rev));
}
}
private IEnumerator FlashImageRoutine(Revenant rev)
{
float alpha = Mathf.Clamp(1f - Vector3.Distance(((Component)rev).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position) / 100f, 0.1f, 1f);
Noise.SetFloat("_Alpha", Random.Range(0.25f, 0.5f));
((Component)Image).gameObject.SetActive(true);
if (rev.JumpscareImages)
{
Image.sprite = rev.GetJumpscare();
((Graphic)Image).color = new Color(1f, 1f, 1f, alpha);
}
else
{
((Graphic)Image).color = new Color(1f, 1f, 1f, 0f);
((Graphic)TendrilImages[0]).color = new Color(1f, 1f, 1f, alpha);
((Graphic)TendrilImages[1]).color = new Color(1f, 1f, 1f, alpha);
Tendrils.SetActive(true);
}
GlitchSound.pitch = Random.Range(PitchRange.x, PitchRange.y);
GlitchSound.Play();
if (!rev.JumpscareImages)
{
yield return (object)new WaitForSeconds(0.2f);
float startNoiseAlpha = Noise.GetFloat("_Alpha");
float startTendrilAlpha = ((Graphic)TendrilImages[0]).color.a;
float startCrtAlpha = ((Graphic)Crt).color.a;
float startVolume = GlitchSound.volume;
while (((Graphic)TendrilImages[0]).color.a != 0f)
{
((Graphic)TendrilImages[0]).color = new Color(1f, 1f, 1f, Mathf.MoveTowards(((Graphic)TendrilImages[0]).color.a, 0f, Time.deltaTime * 2f));
((Graphic)TendrilImages[1]).color = ((Graphic)TendrilImages[0]).color;
float percentageDone = ((Graphic)TendrilImages[0]).color.a / startTendrilAlpha;
Noise.SetFloat("_Alpha", startNoiseAlpha * percentageDone);
((Graphic)Crt).color = new Color(1f, 1f, 1f, startCrtAlpha * percentageDone);
GlitchSound.volume = startVolume * percentageDone;
yield return null;
}
}
yield return (object)new WaitForSeconds(0.2f);
int rand = Random.Range(0, 3);
if (rand == 1 && !rev.Enraged && rev.JumpscareImages)
{
((MonoBehaviour)this).StartCoroutine(FlashImageRoutine(rev));
}
yield return (object)new WaitForSeconds(0.05f);
Noise.SetFloat("_Alpha", 0f);
((Component)Image).gameObject.SetActive(false);
Tendrils.SetActive(false);
GlitchSound.Stop();
}
}
public static class Patches
{
public static void Patch()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (!Harmony.HasAnyPatches("waffle.ultrakill.revenant"))
{
Debug.LogWarning((object)"Trying to patch, patch code run.");
new Harmony("waffle.ultrakill.revenant").PatchAll(typeof(Patches));
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
[HarmonyPostfix]
public static void RunRevenantOnHurt(EnemyIdentifier __instance)
{
Revenant revenant = default(Revenant);
if (((Component)__instance).TryGetComponent<Revenant>(ref revenant))
{
revenant.OnHurt(new StackTrace().ToString());
}
}
[HarmonyPatch(typeof(Projectile), "Collided")]
[HarmonyPrefix]
public static bool MakeProjectileBounce(Projectile __instance, Collider other)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0072: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c8: Unknown result type (might be due to invalid IL or missing references)
if (LayerMaskDefaults.Get((LMD)2).Contains(((Component)other).gameObject.layer))
{
if ((Object)(object)((Component)__instance).GetComponent<IndestructableProjectile>() != (Object)null)
{
return false;
}
BounceProjectile bounceProjectile = default(BounceProjectile);
if (((Component)__instance).TryGetComponent<BounceProjectile>(ref bounceProjectile) && bounceProjectile.HasBouncesLeft())
{
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
Quaternion rotation = bounceProjectile.KeepNonRotated.transform.rotation;
((Component)__instance).transform.forward = Vector3.Reflect(((Component)__instance).transform.forward, ((RaycastHit)(ref val)).normal);
bounceProjectile.KeepNonRotated.transform.rotation = rotation;
}
return false;
}
}
return true;
}
public static bool Contains(this LayerMask mask, int layer)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return LayerMask.op_Implicit(mask) == (LayerMask.op_Implicit(mask) | (1 << layer));
}
}
public class RelativeMoveOverTime : MonoBehaviour
{
public float Speed;
public Vector3 TargetPos;
public void Update()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, TargetPos, Speed * Time.deltaTime);
}
}
public class Revenant : MonoBehaviour
{
[Header("Spawn Animation (feel free to choose this)")]
public RevenantSpawn SpawnType = RevenantSpawn.StompFromSky;
public GameObject SpawnEffect;
[Header("Jumpscares")]
public bool JumpscaresEnabled = true;
public bool JumpscareImages = false;
public Sprite[] JumpscarePool;
public Sprite[] EnragedJumpscarePool;
[Header("Materials")]
public Material DefaultMaterial;
public Material EnragedMaterial;
[Header("Swing Attacks")]
public int SwingDamage = 30;
public SwingCheck2 HeadSwing;
public SwingCheck2 LeftArmSwing;
public SwingCheck2 RightArmSwing;
[Header("Projectile Attack")]
public GameObject ProjectileDecorative;
public GameObject Projectile;
public GameObject LeftYTracker;
public GameObject RightYTracker;
public GameObject ProjectileSpawn;
[Header("Shockwave Stomp")]
public GameObject ShockwaveIntro;
public GameObject ShockwaveAttack;
public GameObject Hole;
[Header("Sound Effects")]
public GameObject BaseSoundBubble;
public AudioClip[] SwingAttackSounds;
public AudioClip VisibilitySound;
public AudioClip InvisibilitySound;
public AudioClip StompSound;
[Header("Lighting")]
public Light Glow;
public Color DefaultColour;
public Color RageColour;
[Header("Misc")]
public GameObject ParryFlash;
public GameObject NoParryFlash;
public GameObject EnragedEffect;
public GameObject DeathEffect;
public GameObject SeasonalHatScaler;
private float _glowStartRange;
public static float DownOffsetMultiplier;
[HideInInspector]
public RevenantState RevState = null;
[HideInInspector]
public Machine Machine;
[HideInInspector]
public float ForwardBoost;
[HideInInspector]
public bool LookAtPlayer;
[HideInInspector]
public bool ResetRotation;
[HideInInspector]
public Quaternion TargetRotation;
[HideInInspector]
public bool Enraged;
[HideInInspector]
public GameObject CurrentEnragedEffect;
private bool _hasStomped = false;
private Vector3 _currentPredicted;
private bool _trackPlayer = false;
private int _difficulty;
public float SpeedMultiplier
{
get
{
float num = Machine.eid?.totalSpeedModifier ?? 1f;
num += ((_difficulty <= 1) ? (-0.15f) : 0f);
num += ((_difficulty >= 4) ? 0.15f : 0f);
return num + (Enraged ? 0.5f : 0f);
}
}
private float _frameTime => 1f / 24f / SpeedMultiplier;
static Revenant()
{
DownOffsetMultiplier = 2.5f;
Patches.Patch();
}
public void Start()
{
Machine = ((Component)this).GetComponent<Machine>();
Machine.anim = ((Component)this).GetComponentInChildren<Animator>();
UpdateBuff();
_glowStartRange = Glow.range;
if (((Behaviour)Machine).enabled)
{
Debug.LogError((object)"The Revenant Machine component should be off by default.");
}
if (SpawnType == RevenantSpawn.StompFromSky)
{
Machine.anim.SetBool("Stomp First Frame", true);
}
else
{
if (SpawnType == RevenantSpawn.AppearFromInvisibility)
{
((MonoBehaviour)this).StartCoroutine(GoVisible());
}
if (SpawnType == RevenantSpawn.Standard)
{
SpawnEffect.SetActive(true);
}
((Behaviour)Machine).enabled = true;
}
if (((Component)Machine).GetComponent<EnemyIdentifier>().difficultyOverride >= 0)
{
_difficulty = ((Component)Machine).GetComponent<EnemyIdentifier>().difficultyOverride;
}
else
{
_difficulty = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0);
}
}
public void UpdateBuff()
{
int damage = (int)((float)SwingDamage * (Machine.eid?.totalDamageModifier ?? 1f));
HeadSwing.damage = damage;
LeftArmSwing.damage = damage;
RightArmSwing.damage = damage;
Machine.anim.speed = SpeedMultiplier;
}
public void Update()
{
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: 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_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: 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_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0424: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0414: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_0484: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
EnemyIdentifier eid = Machine.eid;
if ((eid != null && eid.dead) || (SpawnType == RevenantSpawn.StompFromSky && !_hasStomped))
{
return;
}
if (BlindEnemies.Blind)
{
if (RevState != null)
{
RevState.End();
}
return;
}
if (RevState != null)
{
RevenantState revState = RevState;
if (revState == null || !revState.Complete)
{
goto IL_009a;
}
}
DecideState();
goto IL_009a;
IL_009a:
RevState.Update();
bool flag = true;
if (RevState.GetType() == typeof(PassiveState))
{
flag = false;
}
if (RevState.GetType() == typeof(RandomMeleeState) && (RevState as RandomMeleeState).AttackDone)
{
flag = false;
}
if (!LookAtPlayer && !ResetRotation)
{
flag = false;
}
if (_trackPlayer)
{
_currentPredicted = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
}
if (flag)
{
Quaternion rotation = ((Component)this).transform.rotation;
if (LookAtPlayer)
{
InstantLookAtPlayerPredicted();
TargetRotation = ((Component)this).transform.rotation;
((Component)this).transform.rotation = rotation;
}
if (ResetRotation)
{
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
eulerAngles.x = 0f;
TargetRotation = Quaternion.Euler(eulerAngles);
}
((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, TargetRotation, Time.deltaTime * 240f);
}
if (ForwardBoost != 0f)
{
float num = Vector3.Distance(((Component)this).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position);
float num2 = 40f;
if (num < 60f)
{
num2 -= 15f;
}
if (num < 30f)
{
num2 += 20f;
}
if (num < 15f)
{
num2 += 20f;
}
if (num < 5f)
{
num2 += 50f;
}
ForwardBoost = Mathf.MoveTowards(ForwardBoost, 0f, Time.deltaTime * num2 * SpeedMultiplier);
Transform transform = ((Component)this).transform;
transform.position += ((Component)this).transform.forward * (ForwardBoost * Time.deltaTime * SpeedMultiplier);
}
Vector3 val = (LeftYTracker.transform.position + RightYTracker.transform.position) / 2f;
ProjectileSpawn.transform.position = val + ProjectileSpawn.transform.forward * 5f;
if (ForwardBoost > 0f)
{
Vector3 val2 = Vector3.zero;
RaycastHit val3 = default(RaycastHit);
RaycastHit val4 = default(RaycastHit);
RaycastHit val5 = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 3f, ((Component)this).transform.forward, ref val3, 2f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
val2 = ((RaycastHit)(ref val3)).normal;
}
else if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward + Vector3.up, ref val4, 2f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
val2 = ((RaycastHit)(ref val4)).normal;
}
else if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 6f, ((Component)this).transform.forward, ref val5, 2f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
val2 = ((RaycastHit)(ref val5)).normal;
}
if (val2 != Vector3.zero)
{
Reflect(val2);
}
}
}
public void Reflect(Vector3 normal)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_0055: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)$"Reflecting, normal {normal}");
((Component)this).transform.forward = Vector3.Reflect(((Component)this).transform.forward, normal);
TargetRotation = ((Component)this).transform.rotation;
_currentPredicted = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
}
public void OnCollisionEnter(Collision col)
{
//IL_0056: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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)
if (RevState.GetState<RandomMeleeState>(out var _))
{
ContactPoint[] array = col.contacts.Where((ContactPoint col) => LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)) == (LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)) | (1 << ((Component)((ContactPoint)(ref col)).otherCollider).gameObject.layer))).ToArray();
RaycastHit val = default(RaycastHit);
if (array.Length != 0 && Physics.Raycast(((Component)this).transform.position, ((ContactPoint)(ref array[0])).point - ((Component)this).transform.position, ref val, 100f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
Reflect(((RaycastHit)(ref val)).normal);
}
}
}
public void StompAnimation()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_004b: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
((MonoBehaviour)this).StartCoroutine(StompEntrance(((RaycastHit)(ref val)).point + ((Component)this).transform.forward * 0.1f));
}
}
public IEnumerator StompAttack(Vector3 position, AudioSource source)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
yield return ((MonoBehaviour)this).StartCoroutine(GoVisible());
Machine.anim.SetBool("Stomp First Frame", true);
yield return (object)new WaitForSeconds(0.1f);
CreateParryFlash(ParryFlash);
Machine.parryable = true;
yield return StompFall(position, 2f, lockAtPlayer: true, doSplatter: false, doSplatterDamage: false, source);
Machine.parryable = false;
Object.Instantiate<GameObject>(ShockwaveAttack, ((Component)this).transform.position, Quaternion.identity);
}
public IEnumerator StompEntrance(Vector3 position)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)Machine).enabled = true;
yield return null;
CreateSoundClip(StompSound, out var source, shouldPlay: false, loop: true);
yield return StompFall(position, 1f, lockAtPlayer: false, doSplatter: false, doSplatterDamage: false, source);
source.Stop();
Object.Instantiate<GameObject>(ShockwaveIntro, ((Component)this).transform.position, Quaternion.identity);
_hasStomped = true;
}
public IEnumerator StompFall(Vector3 position, float speedMultiplier = 1f, bool lockAtPlayer = false, bool doSplatter = false, bool doSplatterDamage = false, AudioSource source = null)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
speedMultiplier *= SpeedMultiplier;
((Component)this).transform.LookAt(position);
if (!doSplatter)
{
Transform transform = ((Component)this).transform;
transform.rotation *= Quaternion.Euler(-90f, 0f, 0f);
}
else
{
((Component)this).transform.Rotate(0f, 180f, 0f, (Space)1);
position += ((Component)this).transform.forward;
}
float pointOffset = 3f;
float rateOfFall = 15f;
float timeToWait = _frameTime * 33f / speedMultiplier;
if (!doSplatter)
{
Machine.anim.SetBool("Stomp First Frame", false);
}
else
{
Machine.anim.Play("Stomp Air");
rateOfFall = 50f;
timeToWait = 0f;
}
Machine.anim.speed = SpeedMultiplier * speedMultiplier;
float time = 0f;
RaycastHit hit2 = default(RaycastHit);
while (time < timeToWait)
{
if (lockAtPlayer)
{
if (Physics.Raycast(((Component)this).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)this).transform.position, ref hit2, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
((Component)this).transform.LookAt(((RaycastHit)(ref hit2)).point);
Transform transform2 = ((Component)this).transform;
transform2.rotation *= Quaternion.Euler(-90f, 0f, 0f);
position = ((RaycastHit)(ref hit2)).point;
}
hit2 = default(RaycastHit);
}
time += Time.deltaTime;
yield return null;
}
Machine.anim.speed = SpeedMultiplier;
if (source != null)
{
source.Play();
}
bool hasDone = false;
RaycastHit hit = default(RaycastHit);
do
{
if (Vector3.Distance(((Component)this).transform.position, position) <= pointOffset && !hasDone)
{
if (doSplatterDamage && !Enraged)
{
if (Physics.Raycast(((Component)this).transform.position, position - ((Component)this).transform.position, ref hit, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
((Component)this).transform.rotation = Quaternion.LookRotation(((RaycastHit)(ref hit)).normal);
if (((Component)((RaycastHit)(ref hit)).collider).tag == "Floor")
{
Machine.anim.SetTrigger("Splat Floor");
}
else
{
Machine.anim.SetTrigger("Splat Wall");
}
}
else
{
Machine.anim.SetTrigger("Splat Wall");
}
hit = default(RaycastHit);
}
else
{
ResetRotation = true;
Machine.anim.SetTrigger("Stomp Land");
}
hasDone = true;
}
rateOfFall = Mathf.MoveTowards(rateOfFall, float.MaxValue, 75f * Time.deltaTime * speedMultiplier);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, position, rateOfFall * Time.deltaTime);
yield return null;
}
while (((Component)this).transform.position != position);
if (source != null)
{
source.Stop();
}
}
public void InstantLookAtPlayer()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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)
((Component)this).transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform.position + Vector3.down * DownOffsetMultiplier);
}
public void InstantLookAtPlayerPredicted()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
((Component)this).transform.LookAt(_currentPredicted + Vector3.down * DownOffsetMultiplier);
}
public void Enrage()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
if (!Enraged)
{
float @float = ((Renderer)Machine.smr).material.GetFloat("_OpacScale");
((Renderer)Machine.smr).material = new Material(EnragedMaterial);
((Renderer)Machine.smr).material.SetFloat("_OpacScale", @float);
CurrentEnragedEffect = Object.Instantiate<GameObject>(EnragedEffect);
CurrentEnragedEffect.transform.parent = Machine.chest.transform;
CurrentEnragedEffect.transform.localPosition = Vector3.zero;
CurrentEnragedEffect.transform.localRotation = Quaternion.identity;
Glow.color = RageColour;
Enraged = true;
UpdateBuff();
}
}
public void Deenrage()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
Object.Destroy((Object)(object)CurrentEnragedEffect);
Enraged = false;
float @float = ((Renderer)Machine.smr).material.GetFloat("_OpacScale");
((Renderer)Machine.smr).material = new Material(DefaultMaterial);
((Renderer)Machine.smr).material.SetFloat("_OpacScale", @float);
Glow.color = DefaultColour;
UpdateBuff();
}
public IEnumerator DeenrageAfterTime()
{
int seconds = (_difficulty + 1) * 3;
for (int i = 0; i < seconds * 2; i++)
{
if (Random.value > 0.5f && !Machine.eid.dead)
{
JumpscareCanvas.Instance.FlashImage(this);
}
yield return (object)new WaitForSeconds(0.5f);
}
Deenrage();
}
public void OnHurt(string origin)
{
if (Machine.eid.hitter == "coin" || origin.Contains("Coin.ReflectRevolver"))
{
Enrage();
((MonoBehaviour)this).StartCoroutine(DeenrageAfterTime());
}
}
public void DecideState()
{
//IL_009c: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
if (Machine.eid.dead)
{
return;
}
StompState castState;
if (RevState == null)
{
RevState = new PassiveState(this);
}
else if (RevState.GetState<StompState>(out castState) && castState.ShouldCombo)
{
if ((double)Random.value < 0.5)
{
RevState = new RandomMeleeState(this, originatesFromCombo: true);
}
else
{
RevState = new ProjectileAttackState(this);
}
}
else if (Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) <= 40f)
{
if ((double)Random.value < ((!Enraged) ? 0.75 : 0.5))
{
RevState = new RandomMeleeState(this);
}
else if ((double)Random.value < 0.8)
{
CheckForStomp();
}
else
{
RevState = new ProjectileAttackState(this);
}
}
else if (Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) > 40f)
{
if ((double)Random.value < 0.2 && !Enraged)
{
RevState = new RandomMeleeState(this);
}
else
{
CheckForStomp();
}
}
else
{
RevState = new PassiveState(this);
}
}
public void CheckForStomp()
{
//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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//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_004b: 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)
RaycastHit val = default(RaycastHit);
bool flag = Physics.Raycast(((Component)MonoSingleton<NewMovement>.Instance).transform.position, Vector3.up, ref val, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)));
RevState = new StompState(this, flag ? ((RaycastHit)(ref val)).point : (((Component)MonoSingleton<NewMovement>.Instance).transform.position + Vector3.up * 25f));
}
public void Death()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(DeathEffect);
val.transform.parent = Machine.chest.transform;
val.transform.localPosition = Vector3.zero;
val.transform.localRotation = Quaternion.identity;
ResetXRotation();
((MonoBehaviour)this).StartCoroutine(DeathAnimation());
Machine.anim.StopPlayback();
RevState.End();
}
public void ResetXRotation()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
Quaternion rotation = ((Component)this).transform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
eulerAngles.x = 0f;
((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
}
public IEnumerator GoInvisible(float timeToWait = 0f, bool invisAnimation = false)
{
yield return (object)new WaitForSeconds(timeToWait);
CreateSoundClip(InvisibilitySound, out var sound);
sound.pitch = Random.Range(0.75f, 1.25f);
if (invisAnimation)
{
Machine.anim.SetTrigger("Turn Invis");
yield return (object)new WaitForSeconds(0.25f / SpeedMultiplier);
}
while (((Renderer)Machine.smr).material.GetFloat("_OpacScale") != 0f && !Machine.eid.dead)
{
float targetScale = Mathf.MoveTowards(((Renderer)Machine.smr).material.GetFloat("_OpacScale"), 0f, Time.deltaTime * 1.5f * SpeedMultiplier);
((Renderer)Machine.smr).material.SetFloat("_OpacScale", targetScale);
SeasonalHatScaler.transform.localScale = targetScale * Vector3.one;
Glow.range = _glowStartRange * targetScale;
yield return null;
}
if (Machine.eid.hooked)
{
MonoSingleton<HookArm>.Instance.StopThrow(1f, true);
}
Nail[] componentsInChildren = ((Component)this).GetComponentsInChildren<Nail>();
foreach (Nail nail in componentsInChildren)
{
((MonoBehaviour)this).StartCoroutine(DetachNail(nail));
}
}
public IEnumerator DetachNail(Nail nail)
{
((Component)nail).transform.parent = null;
((Component)nail).gameObject.AddComponent<Rigidbody>();
yield return (object)new WaitForSeconds(2f);
Object.Destroy((Object)(object)((Component)nail).gameObject);
}
public IEnumerator GoVisible()
{
CreateSoundClip(VisibilitySound, out var sound);
sound.pitch = Random.Range(0.75f, 1.25f);
while (((Renderer)Machine.smr).material.GetFloat("_OpacScale") != 1f)
{
float targetScale = Mathf.MoveTowards(((Renderer)Machine.smr).material.GetFloat("_OpacScale"), 1f, Time.deltaTime * 3f * SpeedMultiplier);
((Renderer)Machine.smr).material.SetFloat("_OpacScale", targetScale);
SeasonalHatScaler.transform.localScale = targetScale * Vector3.one;
Glow.range = _glowStartRange * targetScale;
yield return null;
}
}
public Sprite GetJumpscare()
{
return Enraged ? EnragedJumpscarePool[Random.Range(0, EnragedJumpscarePool.Length)] : JumpscarePool[Random.Range(0, JumpscarePool.Length)];
}
public IEnumerator Melee1(bool goVisible = true)
{
if (goVisible)
{
yield return ((MonoBehaviour)this).StartCoroutine(GoVisible());
yield return (object)new WaitForSeconds(0.1f / SpeedMultiplier);
}
LookAtPlayer = true;
Machine.anim.SetTrigger("Melee1");
Machine.parryable = true;
CreateParryFlash(ParryFlash);
_trackPlayer = true;
yield return (object)new WaitForSeconds(_frameTime * 6f);
ForwardBoost = 70f;
if (Machine.parryable)
{
HeadSwing.DamageStart();
}
CreateRandomSwing();
yield return (object)new WaitForSeconds(_frameTime * 17f);
_trackPlayer = false;
yield return (object)new WaitForSeconds(_frameTime * 18f);
Machine.parryable = false;
HeadSwing.DamageStop();
ResetRotation = true;
((RandomMeleeState)RevState).AttackDone = true;
yield return (object)new WaitForSeconds(_frameTime * 21f);
LookAtPlayer = false;
yield return ((MonoBehaviour)this).StartCoroutine(GoInvisible());
ResetXRotation();
ResetRotation = false;
((RandomMeleeState)RevState).AttackDone = false;
}
public IEnumerator Melee2(bool goVisible = true)
{
if (goVisible)
{
yield return ((MonoBehaviour)this).StartCoroutine(GoVisible());
yield return (object)new WaitForSeconds(0.1f / SpeedMultiplier);
}
LookAtPlayer = true;
Machine.anim.SetTrigger("Melee2");
Machine.parryable = false;
CreateParryFlash(NoParryFlash);
yield return (object)new WaitForSeconds(_frameTime * 5f);
_currentPredicted = MonoSingleton<PlayerTracker>.Instance.PredictPlayerPosition(0.5f);
ForwardBoost = 60f;
LeftArmSwing.DamageStart();
CreateRandomSwing();
yield return (object)new WaitForSeconds(_frameTime * 5f);
yield return (object)new WaitForSeconds(_frameTime * 16f);
LeftArmSwing.DamageStop();
LookAtPlayer = false;
Machine.parryable = true;
CreateParryFlash(ParryFlash);
InstantLookAtPlayer();
yield return (object)new WaitForSeconds(_frameTime * 5f);
LookAtPlayer = true;
_currentPredicted = MonoSingleton<PlayerTracker>.Instance.PredictPlayerPosition(0.5f);
ForwardBoost = 60f;
if (Machine.parryable)
{
RightArmSwing.DamageStart();
}
CreateRandomSwing();
yield return (object)new WaitForSeconds(_frameTime * 3f);
yield return (object)new WaitForSeconds(_frameTime * 7f);
LookAtPlayer = false;
Machine.parryable = false;
RightArmSwing.DamageStop();
ResetRotation = true;
((RandomMeleeState)RevState).AttackDone = true;
yield return (object)new WaitForSeconds(_frameTime * 31f);
yield return ((MonoBehaviour)this).StartCoroutine(GoInvisible());
ResetXRotation();
ResetRotation = false;
((RandomMeleeState)RevState).AttackDone = false;
}
public IEnumerator Melee3(bool goVisible = true)
{
if (goVisible)
{
yield return ((MonoBehaviour)this).StartCoroutine(GoVisible());
yield return (object)new WaitForSeconds(0.1f / SpeedMultiplier);
}
_currentPredicted = MonoSingleton<PlayerTracker>.Instance.PredictPlayerPosition(1f);
LookAtPlayer = true;
Machine.anim.SetTrigger("Melee3");
yield return (object)new WaitForSeconds(_frameTime * 4f);
Machine.parryable = false;
CreateParryFlash(NoParryFlash);
yield return (object)new WaitForSeconds(_frameTime * 3f);
_trackPlayer = true;
ForwardBoost = 60f;
LeftArmSwing.DamageStart();
RightArmSwing.DamageStart();
CreateRandomSwing();
yield return (object)new WaitForSeconds(_frameTime * 5f);
yield return (object)new WaitForSeconds(_frameTime * 16f);
_trackPlayer = false;
LookAtPlayer = false;
LeftArmSwing.DamageStop();
RightArmSwing.DamageStop();
ResetRotation = true;
((RandomMeleeState)RevState).AttackDone = true;
yield return (object)new WaitForSeconds(_frameTime * 24f);
yield return ((MonoBehaviour)this).StartCoroutine(GoInvisible());
ResetXRotation();
ResetRotation = false;
((RandomMeleeState)RevState).AttackDone = false;
}
public void CreateSoundClip(AudioClip clip, out AudioSource source, bool shouldPlay = true, bool loop = false)
{
GameObject val = Object.Instantiate<GameObject>(BaseSoundBubble, ((Component)this).transform);
source = val.GetComponent<AudioSource>();
source.loop = loop;
source.clip = clip;
((Object)val).name = "Sound Player: " + ((Object)clip).name;
if (shouldPlay)
{
source.Play();
}
}
public void CreateRandomSwing()
{
CreateSoundClip(SwingAttackSounds[Random.Range(0, SwingAttackSounds.Length - 1)], out var source);
source.pitch = Random.Range(0.5f, 1.5f);
}
public IEnumerator Stomp()
{
yield return ((MonoBehaviour)this).StartCoroutine(GoVisible());
}
public IEnumerator RangedAttack()
{
_trackPlayer = true;
LookAtPlayer = true;
yield return ((MonoBehaviour)this).StartCoroutine(GoVisible());
Machine.anim.SetTrigger("Range Attack");
GameObject decoProjectile = Object.Instantiate<GameObject>(ProjectileDecorative, ProjectileSpawn.transform);
if (RevState.GetState<ProjectileAttackState>(out var pas))
{
pas.DecoProjectile = decoProjectile;
}
((MonoBehaviour)this).StartCoroutine(PrepareDecoProjectile(decoProjectile));
yield return (object)new WaitForSeconds(_frameTime * 25f);
_trackPlayer = false;
InstantLookAtPlayer();
Object.Destroy((Object)(object)decoProjectile);
GameObject realProjectile = Object.Instantiate<GameObject>(Projectile, ProjectileSpawn.transform.position, ProjectileSpawn.transform.rotation);
realProjectile.transform.LookAt(((Component)MonoSingleton<CameraController>.Instance).transform);
Projectile projectile = realProjectile.GetComponent<Projectile>();
projectile.target = Machine.eid.target;
projectile.speed = 60f * SpeedMultiplier;
Projectile[] componentsInChildren = realProjectile.GetComponentsInChildren<Projectile>();
foreach (Projectile subProj in componentsInChildren)
{
subProj.damage *= Machine.eid.totalDamageModifier;
}
LookAtPlayer = false;
((ProjectileAttackState)RevState).AttackDone = true;
ResetRotation = true;
yield return (object)new WaitForSeconds(_frameTime * 17f);
yield return ((MonoBehaviour)this).StartCoroutine(GoInvisible(0f, invisAnimation: true));
ResetXRotation();
ResetRotation = false;
((ProjectileAttackState)RevState).AttackDone = false;
}
public IEnumerator PrepareDecoProjectile(GameObject projectile)
{
float timeElapsed = 0f;
AudioSource source = projectile.GetComponent<AudioSource>();
float startVol = source.volume;
Vector3 startScale = projectile.transform.localScale;
while (timeElapsed < 1.5f && (Object)(object)projectile != (Object)null)
{
source.volume = startVol * (timeElapsed / 1.5f);
projectile.transform.localScale = startScale * (timeElapsed / 1.5f);
timeElapsed += Time.deltaTime * SpeedMultiplier;
yield return null;
}
}
public void CreateParryFlash(GameObject flash)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_003d: 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)
Transform transform = Object.Instantiate<GameObject>(flash, Machine.chest.transform.position + ((Component)this).transform.forward, ((Component)this).transform.rotation).transform;
transform.localScale *= 2.5f;
}
public void GotParried()
{
if (RevState.GetState<StompState>(out var castState) && !castState.AttackDone && !Machine.eid.dead)
{
((MonoBehaviour)this).StartCoroutine(castState.StartSpirallingAndSet());
}
Machine.parryable = false;
HeadSwing.DamageStop();
LeftArmSwing.DamageStop();
RightArmSwing.DamageStop();
}
public IEnumerator DeathAnimation()
{
Deenrage();
((Renderer)Machine.smr).material.SetFloat("_OpacScale", 1f);
Machine.anim.Play("Death");
yield return (object)new WaitForSeconds(_frameTime * 75f);
((Behaviour)Machine.anim).enabled = false;
Rigidbody[] componentsInChildren = ((Component)this).GetComponentsInChildren<Rigidbody>();
foreach (Rigidbody rb in componentsInChildren)
{
rb.isKinematic = false;
rb.useGravity = true;
}
}
}
public enum RevenantSpawn
{
StompFromSky,
AppearFromInvisibility,
Standard
}
public class RevenantAssets : MonoBehaviour
{
private static RevenantAssets _instance;
public GameObject TemplateJumpscareCanvas;
public Material NoiseMaterial;
public static RevenantAssets Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
throw new Exception("You have not placed the RevenantAssets singleton in your scene. Please place it.");
}
return _instance;
}
}
public void Start()
{
_instance = this;
}
}
public class ShockwaveScaleOut : MonoBehaviour
{
private PhysicalShockwave _shockwave;
private MeshRenderer _visual;
private SpriteRenderer _sprite;
public void Start()
{
if (!((Component)this).TryGetComponent<PhysicalShockwave>(ref _shockwave) || !((Component)((Component)this).transform.Find("Visual")).TryGetComponent<MeshRenderer>(ref _visual) || !((Component)((Component)this).transform.Find("Shockwave")).TryGetComponent<SpriteRenderer>(ref _sprite))
{
Object.Destroy((Object)(object)this);
}
}
public void Update()
{
//IL_0007: 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_0045: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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)
if (((Component)this).transform.localScale.x >= _shockwave.maxSize * 0.75f)
{
Color color = ((Renderer)_visual).material.GetColor("_Color");
color = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(color), Color.op_Implicit(new Color(color.r, color.g, color.b, 0f)), Time.deltaTime * 10f));
((Renderer)_visual).material.SetColor("_Color", color);
Color color2 = _sprite.color;
_sprite.color = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(color2), Color.op_Implicit(new Color(color2.r, color2.g, color2.b, 0f)), Time.deltaTime * 5f));
}
}
}
}
namespace Waffle.Revenant.States
{
public class InvisErraticState : RevenantState
{
public float TimeBeforeInvis;
public float Countdown;
public InvisErraticState(Revenant revenant)
: base(revenant)
{
}
public override void Begin()
{
((MonoBehaviour)Revenant).StartCoroutine(Revenant.GoInvisible(TimeBeforeInvis, invisAnimation: true));
((MonoBehaviour)Revenant).StartCoroutine(EndInTime());
TeleportAroundPlayer(15f);
Revenant.InstantLookAtPlayer();
Revenant.ForwardBoost = 40f;
}
public IEnumerator EndInTime()
{
yield return (object)new WaitForSeconds(Random.Range(0.5f, 2f) / Revenant.SpeedMultiplier);
End();
}
public void TeleportAroundPlayer(float distance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Random.onUnitSphere * distance;
val.y = 0f;
((Vector3)(ref val)).Normalize();
((Component)Revenant).transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position + val;
}
}
public class PassiveState : RevenantState
{
public bool GoingRight;
public PassiveState(Revenant revenant)
: base(revenant)
{
}
public override void Begin()
{
GoingRight = Random.value >= 0.5f;
CheckDirection();
((MonoBehaviour)Revenant).StartCoroutine(EndInTime());
}
public IEnumerator EndInTime()
{
yield return (object)new WaitForSeconds(Random.Range(1f, 3f) / Revenant.SpeedMultiplier);
End();
}
public override void End()
{
Revenant.Machine.anim.SetBool("Float Left", false);
Revenant.Machine.anim.SetBool("Float Right", false);
base.End();
}
public override void Update()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//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_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)
//IL_0036: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_00ad: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
CheckDirection();
Quaternion val = Quaternion.LookRotation(((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)Revenant).transform.position, Vector3.up);
((Component)Revenant).transform.rotation = Quaternion.RotateTowards(((Component)Revenant).transform.rotation, val, Time.deltaTime * (10f * Quaternion.Angle(val, ((Component)Revenant).transform.rotation) + 2f) * Revenant.SpeedMultiplier);
Revenant.Machine.rb.MovePosition(((Component)Revenant).transform.position + ((Component)Revenant).transform.right * (float)(GoingRight ? 1 : (-1)) * 5f * Time.deltaTime * Revenant.SpeedMultiplier);
}
public void CheckDirection()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)Revenant).transform.position, (float)((!GoingRight) ? 1 : (-1)) * ((Component)Revenant).transform.right, ref val, 2f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
GoingRight = !GoingRight;
}
Revenant.Machine.anim.SetBool("Float Left", !GoingRight);
Revenant.Machine.anim.SetBool("Float Right", GoingRight);
}
}
public class ProjectileAttackState : PassiveState
{
private Coroutine CurrentAttack;
public bool AttackDone;
public GameObject DecoProjectile;
public ProjectileAttackState(Revenant revenant)
: base(revenant)
{
}
public override void Begin()
{
((MonoBehaviour)Revenant).StartCoroutine(DoStuff());
}
public IEnumerator DoStuff()
{
CurrentAttack = ((MonoBehaviour)Revenant).StartCoroutine(Revenant.RangedAttack());
yield return CurrentAttack;
End();
}
public override void End()
{
((MonoBehaviour)Revenant).StopCoroutine(CurrentAttack);
Object.Destroy((Object)(object)DecoProjectile);
base.End();
}
public override void Update()
{
if (AttackDone)
{
base.Update();
}
}
}
public class RandomMeleeState : PassiveState
{
public bool AttackDone = false;
private Coroutine _currentAttack;
private bool _fromCombo;
public RandomMeleeState(Revenant revenant, bool originatesFromCombo = false)
: base(revenant)
{
_fromCombo = originatesFromCombo;
}
public override void Begin()
{
((MonoBehaviour)Revenant).StartCoroutine(DoStuff());
}
public IEnumerator DoStuff()
{
yield return null;
if (!_fromCombo)
{
JumpscareCanvas.Instance.FlashImage(Revenant);
yield return (object)new WaitForSeconds(Random.Range(0.2f, 0.4f) / Revenant.SpeedMultiplier);
float mult = 6f;
Vector3 addedDirection = default(Vector3);
switch (Random.Range(0, 3))
{
case 0:
addedDirection = ((Component)MonoSingleton<NewMovement>.Instance).transform.forward * mult;
break;
case 1:
addedDirection = -((Component)MonoSingleton<NewMovement>.Instance).transform.forward * mult;
break;
case 2:
addedDirection = -((Component)MonoSingleton<NewMovement>.Instance).transform.right * mult;
break;
case 3:
addedDirection = ((Component)MonoSingleton<NewMovement>.Instance).transform.right * mult;
break;
}
RaycastHit hit = default(RaycastHit);
if (Physics.Raycast(((Component)MonoSingleton<NewMovement>.Instance).transform.position, addedDirection, ref hit, mult))
{
((Component)Revenant).transform.position = ((RaycastHit)(ref hit)).point;
}
else
{
((Component)Revenant).transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position + addedDirection;
}
hit = default(RaycastHit);
}
Transform transform = ((Component)Revenant).transform;
transform.position += ((Component)Revenant).transform.forward * 2f;
IEnumerator chosenAttack = null;
switch (Random.Range(0, 3))
{
case 0:
chosenAttack = Revenant.Melee1();
break;
case 1:
chosenAttack = Revenant.Melee2();
break;
case 2:
chosenAttack = Revenant.Melee3();
break;
}
Revenant.InstantLookAtPlayer();
_currentAttack = ((MonoBehaviour)Revenant).StartCoroutine(chosenAttack);
yield return _currentAttack;
End();
}
public override void End()
{
((MonoBehaviour)Revenant).StopCoroutine(_currentAttack);
base.End();
}
public override void Update()
{
if (AttackDone)
{
base.Update();
}
}
}
public class RevenantState
{
public Revenant Revenant;
public bool Complete = false;
public RevenantState(Revenant revenant)
{
Revenant = revenant;
Begin();
}
public virtual void Begin()
{
}
public virtual void End()
{
Complete = true;
}
public virtual void Update()
{
}
}
public static class RevenantStateExtensions
{
public static bool GetState<T>(this RevenantState state, out T castState) where T : RevenantState
{
if (state.GetType() == typeof(T))
{
castState = state as T;
return true;
}
castState = null;
return false;
}
}
public class StompState : PassiveState
{
public bool AttackDone = false;
public bool Bounced = false;
public bool ShouldCombo = false;
private Coroutine _currentAttack;
private Vector3 _startPos;
private float _startAnimSpeed;
private AudioSource _whooshSource;
public StompState(Revenant revenant, Vector3 startPos)
: base(revenant)
{
//IL_001f: 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)
_startPos = startPos;
}
public override void Begin()
{
((MonoBehaviour)Revenant).StartCoroutine(DoStuff());
}
public IEnumerator DoStuff()
{
JumpscareCanvas.Instance.FlashImage(Revenant);
yield return (object)new WaitForSeconds(Random.Range(0.2f, 0.4f) / Revenant.SpeedMultiplier);
float mult = 5f;
Vector3 addedDirection = default(Vector3);
switch (Random.Range(0, 3))
{
case 0:
addedDirection = ((Component)MonoSingleton<NewMovement>.Instance).transform.forward * mult;
break;
case 1:
addedDirection = -((Component)MonoSingleton<NewMovement>.Instance).transform.forward * mult;
break;
case 2:
addedDirection = -((Component)MonoSingleton<NewMovement>.Instance).transform.right * mult;
break;
case 3:
addedDirection = ((Component)MonoSingleton<NewMovement>.Instance).transform.right * mult;
break;
}
if (Physics.Raycast(((Component)Revenant).transform.position, addedDirection, mult, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
addedDirection = Vector3.zero;
}
((Component)Revenant).transform.position = _startPos + addedDirection - Vector3.up * 5f;
Vector3 stompToPosition = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
RaycastHit hit = default(RaycastHit);
if (Physics.Raycast(((Component)Revenant).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)Revenant).transform.position, ref hit, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
stompToPosition = ((RaycastHit)(ref hit)).point;
}
_startAnimSpeed = Revenant.Machine.anim.speed;
Revenant.CreateSoundClip(Revenant.StompSound, out _whooshSource, shouldPlay: false, loop: true);
_whooshSource.pitch = 1.25f;
AudioSource whooshSource = _whooshSource;
whooshSource.volume /= 1.5f;
_currentAttack = ((MonoBehaviour)Revenant).StartCoroutine(Revenant.StompAttack(stompToPosition, _whooshSource));
yield return _currentAttack;
Revenant.ResetRotation = true;
float rand = Random.value;
if (!Revenant.Enraged)
{
if (rand < 0.75f)
{
yield return (object)new WaitForSeconds(0.5f / Revenant.SpeedMultiplier);
ShouldCombo = true;
}
else
{
yield return (object)new WaitForSeconds(0.5f / Revenant.SpeedMultiplier);
yield return ((MonoBehaviour)Revenant).StartCoroutine(Revenant.GoInvisible(0f, invisAnimation: true));
}
}
else
{
ShouldCombo = true;
}
Revenant.ResetRotation = false;
Revenant.ResetXRotation();
End();
}
public IEnumerator StartSpirallingAndSet()
{
_currentAttack = ((MonoBehaviour)Revenant).StartCoroutine(StartSpiralling());
yield return _currentAttack;
}
private IEnumerator StartSpiralling()
{
((MonoBehaviour)Revenant).StopCoroutine(_currentAttack);
Revenant.Machine.anim.speed = _startAnimSpeed;
Revenant.Machine.anim.SetBool("Stomp First Frame", false);
Vector3 pos = ((Component)MonoSingleton<CameraController>.Instance).transform.position + ((Component)MonoSingleton<CameraController>.Instance).transform.forward * 100f;
bool didHit = false;
RaycastHit hit = default(RaycastHit);
if (Physics.Raycast(((Component)MonoSingleton<CameraController>.Instance).transform.position, ((Component)MonoSingleton<CameraController>.Instance).transform.forward, ref hit, 10000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
{
pos = ((RaycastHit)(ref hit)).point;
didHit = true;
}
yield return ((MonoBehaviour)Revenant).StartCoroutine(Revenant.StompFall(pos, 1f, lockAtPlayer: false, doSplatter: true, didHit));
_whooshSource.Stop();
if (didHit)
{
Revenant.Machine.eid.hitter = "punch";
Revenant.Machine.eid.DeliverDamage(((Component)Revenant).gameObject, Vector3.zero, Vector3.zero, 4f, false, 0f, (GameObject)null, false);
Object.Instantiate<GameObject>(Revenant.Hole, ((Component)Revenant).transform.position + ((Component)Revenant).transform.up * 2f, ((Component)Revenant).transform.rotation);
}
yield return (object)new WaitForSeconds(2.5f / Revenant.SpeedMultiplier);
yield return Revenant.GoInvisible();
Revenant.ResetRotation = false;
Revenant.ResetXRotation();
End();
}
public override void End()
{
_whooshSource.Stop();
((MonoBehaviour)Revenant).StopCoroutine(_currentAttack);
base.End();
}
public override void Update()
{
if (AttackDone)
{
base.Update();
}
}
}
}