guns/GunEmptySockets.cs

A Gun subtype that grants the player extra projectiles and reduces max ammo based on the number of empty gem sockets on the current weapon. On run start it counts gun gem slots and equipped gems, then adds projectiles and subtracts max ammo equal to empty slots.

Native Interop
public class GunEmptySockets : Gun
{
	public const string ItemId = "gun_empty_sockets";

	public static string Description() => $"For each empty gem socket,\n+1 bullet-icon per shot and -1 ammo";

	public override void OnRunStart()
	{
		base.OnRunStart();

		int totalSlots = Player.CurrentGun?.GemSlots?.Count ?? 0;
		int filledSlots = Player.CurrentGems?.Count ?? 0;
		int emptySlots = totalSlots - filledSlots;

		if ( emptySlots > 0 )
		{
			Player.Modify( this, PlayerStat.NumProjectiles, emptySlots, ModifierType.Add );
			Player.Modify( this, PlayerStat.MaxAmmoCount, -emptySlots, ModifierType.Add );
		}
	}
}