r2mods/ilspy_dump/ror2_csproj/RoR2.Projectile/ProjectileHealOwnerOnDamage...

35 lines
918 B
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 ProjectileHealOwnerOnDamageInflicted : MonoBehaviour, IOnDamageInflictedServerReceiver
{
public float fractionOfDamage;
private ProjectileController projectileController;
private void Awake()
{
projectileController = GetComponent<ProjectileController>();
}
public void OnDamageInflictedServer(DamageReport damageReport)
{
if ((bool)projectileController.owner)
{
HealthComponent component = projectileController.owner.GetComponent<HealthComponent>();
if ((bool)component)
{
HealOrb healOrb = new HealOrb();
healOrb.origin = base.transform.position;
healOrb.target = component.body.mainHurtBox;
healOrb.healValue = damageReport.damageDealt * fractionOfDamage;
healOrb.overrideDuration = 0.3f;
OrbManager.instance.AddOrb(healOrb);
}
}
}
}