A Gem subclass representing a Topaz gem item. It defines ItemId, computes attack speed bonuses by level, provides description strings, and applies a multiplicative attack speed modifier to the Player when run starts.
using Sandbox;
public class GemTopaz : Gem
{
public const string ItemId = "gem_topaz";
private static float GetAttackSpeed( int level ) => 2f + level * 3f;
public static string Description( int level ) => $"+{GetAttackSpeed( level )}% attack speed";
public static string UpgradeDescription( int level ) => $"+{GetAttackSpeed( level - 1 )}%→+{GetAttackSpeed( level )}% attack speed";
public override void OnRunStart()
{
Player.Modify( this, PlayerStat.AttackSpeed, 1f + GetAttackSpeed( Level ) * 0.01f, ModifierType.Mult );
}
}