gems/GemTopaz.cs

Defines GemTopaz, a Gem subclass that provides an attack speed bonus. It computes attack speed percentage from level and applies a multiplicative modifier to the player when the gem activates.

Native Interop
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 );
	}
}