A gem component class that increases bullet homing radius for a player. It defines the item id, computes homing range by level, provides description strings, and applies modifiers to the player's stats when a run starts.
using Sandbox;
public class GemHoming : Gem
{
public const string ItemId = "gem_homing";
private static float GetRange( int level ) => 0.35f + 0.05f * level;
public static string Description( int level ) => $"+{GetRange( level ).ToString( "0.##" )} bullet-icon homing range";
public static string UpgradeDescription( int level ) => $"+{GetRange( level - 1 ).ToString( "0.##" )}→+{GetRange( level ).ToString( "0.##" )} bullet-icon homing range";
public override void OnRunStart()
{
Player.Modify( this, PlayerStat.BulletHomingRadius, GetRange( Level ) * Utils.Meter2Unit, ModifierType.Add );
Player.Modify( this, PlayerStat.BulletHomingRadiusDisplay, GetRange( Level ), ModifierType.Add );
}
}