r2mods/ilspy_dump/ror2_csproj/RoR2.Projectile/UnseenHandHealingProjectile.cs

54 lines
1.4 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using RoR2.Orbs;
using UnityEngine;
namespace RoR2.Projectile;
[RequireComponent(typeof(ProjectileController))]
public class UnseenHandHealingProjectile : MonoBehaviour, IOnDamageInflictedServerReceiver
{
public bool addBarrier;
public bool addHealing;
public float fractionOfDamage;
public float barrierPercent;
private int chakraCount;
public float chakraIncrease;
private ProjectileController projectileController;
private void Awake()
{
projectileController = GetComponent<ProjectileController>();
}
public void OnDamageInflictedServer(DamageReport damageReport)
{
if ((bool)projectileController.owner)
{
HealthComponent component = projectileController.owner.GetComponent<HealthComponent>();
CharacterBody component2 = projectileController.owner.GetComponent<CharacterBody>();
if (component2 != null)
{
chakraCount = component2.GetBuffCount(DLC2Content.Buffs.ChakraBuff);
}
if (addHealing && (bool)component)
{
HealOrb healOrb = new HealOrb();
healOrb.origin = base.transform.position;
healOrb.target = component.body.mainHurtBox;
healOrb.healValue = damageReport.damageDealt * (fractionOfDamage + (float)chakraCount * chakraIncrease);
healOrb.overrideDuration = 0.3f;
OrbManager.instance.AddOrb(healOrb);
}
if (addBarrier)
{
component.AddBarrierAuthority(component2.baseMaxHealth * (barrierPercent + (float)chakraCount * chakraIncrease));
}
}
}
}