A Charm item class that grants the player a fixed number of rerolls at the start of a run. It defines an item id, a reroll count, a description string, and increments the player's NumRerollAvailable in OnRunStart. There's commented-out code for giving items and playing a sound.
using System.Xml.Linq;
using static Sandbox.VertexLayout;
public class CharmDice : Charm
{
public const string ItemId = "charm_dice";
private static int NumRerolls = 5;
public static string Description() => $"Start with +{NumRerolls} reroll-item";
public override void OnRunStart()
{
Player.NumRerollAvailable += NumRerolls;
//for ( int i = 0; i < NumRerolls; i++ )
//{
// Player.GiveItemRpc( "reroll_item", Utils.GetRandomVector() );
//}
//Manager.Instance.PlaySfxNearbyRpc( "scuffle", Player.Position2D, pitch: Game.Random.Float( 0.8f, 0.95f ), volume: 0.85f, maxDist: 300f );
}
}