gems/GemDodge.cs

A gem item class that grants the player one or more instances of the PerkDodge perk at the start of a run and posts a local chat message. It defines an ItemId constant and provides description strings for UI display.

Reflection
using Sandbox;

public class GemDodge : Gem
{
	public const string ItemId = "gem_dodge";

	public static string Description( int level ) => $"Start with {Perk.GetRichTextNameToken( typeof( PerkDodge ) )} {Perk.GetRichTextToken( nameof( PerkDodge ), level )} Lvl {level}";
	public static string UpgradeDescription( int level ) => $"Start with {Perk.GetRichTextNameToken( typeof( PerkDodge ) )} {Perk.GetRichTextToken( nameof(PerkDodge), level )} Lvl [+]{level - 1}[/+]→Lvl [+]{level}[/+]";

	public override void OnRunStart()
	{
		var perkType = TypeLibrary.GetType<PerkDodge>();
		for ( int i = 0; i < Level; i++ )
			Player.AddPerk( perkType );

		Manager.Instance.Chat.AddLocalChatMessage( $"Got {Perk.GetRichTextNameToken( typeof( PerkDodge ) )} {Perk.GetRichTextToken( nameof( PerkDodge ), Level )} Lvl {Level}", from: "" );
	}
}