gems/GemGold.cs

A gem item class for the game, representing a gold gem that increases the chance to get an extra perk choice. It defines item id, chance calculation by level, UI description strings, and applies a stat modifier on run start.

Networking
using Sandbox;

public class GemGold : Gem
{
	public const string ItemId = "gem_gold";

	private static float GetChance( int level ) => 0.10f + level * 0.09f;
	private static int GetChancePct( int level ) => (int)(GetChance( level ) * 100f);

	public static string Description( int level ) => $"{GetChancePct( level )}% chance to see +1 perk choice";
	public static string UpgradeDescription( int level ) => $"{GetChancePct( level - 1 )}%→{GetChancePct( level )}% chance to see +1 perk choice";

	public override void OnRunStart()
	{
		Player.Modify( this, PlayerStat.GemPerkChoiceChance, GetChance( Level ), ModifierType.Add );
	}
}