A Gun subclass that applies buffs/penalties based on empty gem sockets when a run starts. It increases number of projectiles per shot and decreases max ammo equal to the number of empty gem sockets on the player's current gun.
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 );
}
}
}