r2mods/ilspy_dump/ror2_csproj/RoR2.Orbs/InfusionOrb.cs

36 lines
834 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2.Orbs;
public class InfusionOrb : Orb
{
private const float speed = 30f;
public int maxHpValue;
private Inventory targetInventory;
public override void Begin()
{
base.duration = base.distanceToTarget / 30f;
EffectData effectData = new EffectData
{
origin = origin,
genericFloat = base.duration
};
effectData.SetHurtBoxReference(target);
EffectManager.SpawnEffect(OrbStorageUtility.Get("Prefabs/Effects/OrbEffects/InfusionOrbEffect"), effectData, transmit: true);
CharacterBody characterBody = target.GetComponent<HurtBox>()?.healthComponent.GetComponent<CharacterBody>();
if ((bool)characterBody)
{
targetInventory = characterBody.inventory;
}
}
public override void OnArrival()
{
if ((bool)targetInventory)
{
targetInventory.AddInfusionBonus((uint)maxHpValue);
}
}
}