85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
|
using RoR2;
|
||
|
using RoR2.Projectile;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.Networking;
|
||
|
|
||
|
namespace EntityStates;
|
||
|
|
||
|
public class FireFlower2 : BaseState
|
||
|
{
|
||
|
public static GameObject projectilePrefab;
|
||
|
|
||
|
public static float baseDuration;
|
||
|
|
||
|
public static float damageCoefficient;
|
||
|
|
||
|
public static float healthCostFraction;
|
||
|
|
||
|
public static string enterSoundString;
|
||
|
|
||
|
public static string muzzleName;
|
||
|
|
||
|
public static GameObject muzzleFlashPrefab;
|
||
|
|
||
|
private float duration;
|
||
|
|
||
|
private static int FireFlowerStateHash = Animator.StringToHash("FireFlower");
|
||
|
|
||
|
private static int FireFlowerParamHash = Animator.StringToHash("FireFlower.playbackRate");
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
base.OnEnter();
|
||
|
EffectManager.SimpleMuzzleFlash(muzzleFlashPrefab, base.gameObject, muzzleName, transmit: false);
|
||
|
duration = baseDuration / attackSpeedStat;
|
||
|
Util.PlaySound(enterSoundString, base.gameObject);
|
||
|
PlayAnimation("Gesture, Additive", FireFlowerStateHash, FireFlowerParamHash, duration);
|
||
|
if (base.isAuthority)
|
||
|
{
|
||
|
Ray aimRay = GetAimRay();
|
||
|
FireProjectileInfo fireProjectileInfo = default(FireProjectileInfo);
|
||
|
fireProjectileInfo.crit = RollCrit();
|
||
|
fireProjectileInfo.damage = damageCoefficient * damageStat;
|
||
|
fireProjectileInfo.damageColorIndex = DamageColorIndex.Default;
|
||
|
fireProjectileInfo.force = 0f;
|
||
|
fireProjectileInfo.owner = base.gameObject;
|
||
|
fireProjectileInfo.position = aimRay.origin;
|
||
|
fireProjectileInfo.procChainMask = default(ProcChainMask);
|
||
|
fireProjectileInfo.projectilePrefab = projectilePrefab;
|
||
|
fireProjectileInfo.rotation = Quaternion.LookRotation(aimRay.direction);
|
||
|
fireProjectileInfo.useSpeedOverride = false;
|
||
|
FireProjectileInfo fireProjectileInfo2 = fireProjectileInfo;
|
||
|
ProjectileManager.instance.FireProjectile(fireProjectileInfo2);
|
||
|
}
|
||
|
if (NetworkServer.active && (bool)base.healthComponent)
|
||
|
{
|
||
|
DamageInfo damageInfo = new DamageInfo();
|
||
|
damageInfo.damage = base.healthComponent.combinedHealth * healthCostFraction;
|
||
|
damageInfo.position = base.characterBody.corePosition;
|
||
|
damageInfo.force = Vector3.zero;
|
||
|
damageInfo.damageColorIndex = DamageColorIndex.Default;
|
||
|
damageInfo.crit = false;
|
||
|
damageInfo.attacker = null;
|
||
|
damageInfo.inflictor = null;
|
||
|
damageInfo.damageType = DamageType.NonLethal | DamageType.BypassArmor;
|
||
|
damageInfo.procCoefficient = 0f;
|
||
|
damageInfo.procChainMask = default(ProcChainMask);
|
||
|
base.healthComponent.TakeDamage(damageInfo);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override void FixedUpdate()
|
||
|
{
|
||
|
base.FixedUpdate();
|
||
|
if (base.isAuthority && base.fixedAge >= duration)
|
||
|
{
|
||
|
outer.SetNextStateToMain();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override InterruptPriority GetMinimumInterruptPriority()
|
||
|
{
|
||
|
return InterruptPriority.PrioritySkill;
|
||
|
}
|
||
|
}
|