r2mods/ilspy_dump/ror2_csproj/RoR2/OutOfCombatArmorBehavior.cs

33 lines
590 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2;
internal class OutOfCombatArmorBehavior : CharacterBody.ItemBehavior
{
private bool providingBuff;
private void SetProvidingBuff(bool shouldProvideBuff)
{
if (shouldProvideBuff != providingBuff)
{
providingBuff = shouldProvideBuff;
if (providingBuff)
{
body.AddBuff(DLC1Content.Buffs.OutOfCombatArmorBuff);
}
else
{
body.RemoveBuff(DLC1Content.Buffs.OutOfCombatArmorBuff);
}
}
}
private void OnDisable()
{
SetProvidingBuff(shouldProvideBuff: false);
}
private void FixedUpdate()
{
SetProvidingBuff(body.outOfDanger);
}
}