A small Gun subclass that represents a Boomerang gun item. It defines an item id, a fixed perk level, a description string, and on run start it announces giving the perk and adds the PerkBoomerang perk to the player PerkLevel times.
public class GunBoomerang : Gun
{
public const string ItemId = "gun_boomerang";
private const int PerkLevel = 1;
public static string Description() => $"Start with {Perk.GetRichTextNameToken( typeof( PerkBoomerang ) )} {Perk.GetRichTextToken( nameof( PerkBoomerang ), level: PerkLevel )} Lvl {PerkLevel}";
public override void OnRunStart()
{
base.OnRunStart();
Manager.Instance.Chat.AddLocalChatMessage( $"Got {Perk.GetRichTextNameToken( typeof( PerkBoomerang ) )} {Perk.GetRichTextToken( nameof( PerkBoomerang ), level: PerkLevel )} Lvl {PerkLevel}", from: "" );
for( int i = 0; i < PerkLevel; i++ )
Player.AddPerk( TypeLibrary.GetType( typeof( PerkBoomerang ) ) );
//Player.Modify( this, PlayerStat.MaxAmmoCount, -5, ModifierType.Add );
}
}