A Gem subclass defining a gold gem item that increases the chance to see an extra perk choice. It provides item id, chance calculations, text descriptions, and applies a stat modifier on run start.
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 );
}
}