A disabled rare perk class named PerkStealth. It defines a DetectionRangeModifier value per level and stubs for Start and Refresh; most functionality and registration are commented out, so it currently does nothing at runtime.
using System;
using Sandbox;
[Perk( Rarity.Rare, disabled: true, alwaysOfferDebug: false )]
public class PerkStealth : Perk
{
private enum Mod { DetectionRangeModifier };
static PerkStealth()
{
//Register<PerkStealth>(
// name: "Stealthy",
// imagePath: "textures/icons/vector/stealth.png",
// description: level => $"Reduce the range that enemies detect you by {(int)GetValue( level, Mod.DetectionRangeModifier, true )}%",
// upgradeDescription: level => $"Reduce the range that enemies detect you by {(int)GetValue( level - 1, Mod.DetectionRangeModifier, true )}%→{(int)GetValue( level, Mod.DetectionRangeModifier, true )}%"
//);
}
public override void Start()
{
base.Start();
}
public override void Refresh()
{
base.Refresh();
//Player.Modify( this, PlayerStat.DetectionRangeModifier, GetValue( Level, Mod.DetectionRangeModifier ), ModifierType.Mult );
// todo: also reduce time needed to lose target?
}
private static float GetValue( int level, Mod mod, bool isPercent = false )
{
switch ( mod )
{
case Mod.DetectionRangeModifier:
default:
return isPercent
? 15f + 10f * level
: 1f - (0.15f + 0.10f * level);
}
}
}