A small Gun subclass that represents a recoil-related starting gun/perk. It defines an item id, a perk level constant, a Description() helper that returns a formatted string, and OnRunStart that announces the perk locally and adds the PerkRecoil perk to the player twice (PerkLevel times).
public class GunRecoil : Gun
{
public const string ItemId = "gun_recoil";
private const int PerkLevel = 2;
public static string Description() => $"Start with {Perk.GetRichTextNameToken( typeof( PerkRecoil ) )} {Perk.GetRichTextToken( nameof( PerkRecoil ), level: PerkLevel )} Lvl {PerkLevel}";
public override void OnRunStart()
{
base.OnRunStart();
Manager.Instance.Chat.AddLocalChatMessage( $"Got {Perk.GetRichTextNameToken( typeof( PerkRecoil ) )} {Perk.GetRichTextToken( nameof( PerkRecoil ), level: PerkLevel )} Lvl {PerkLevel}", from: "" );
for( int i = 0; i < PerkLevel; i++ )
Player.AddPerk( TypeLibrary.GetType( typeof( PerkRecoil ) ) );
}
}