perks/PerkPushStrength.cs

A Perk class called PerkPushStrength (named "Steroids"). It modifies player stats when applied: increases max HP, scales player size, makes health packs hurt, sets player scale and weight. It also defines push strength and scale values via a helper GetValue.

using System;
using Sandbox;

[Perk( Rarity.Unique, alwaysOfferDebug: false )]
public class PerkPushStrength : Perk
{
	private enum Mod { PushStrength, Scale, MaxHp, };

	static PerkPushStrength()
	{
		Register<PerkPushStrength>(
			name: "Steroids",
			imagePath: "textures/icons/vector/push_strength.png",
			description: level => $"Easily push enemies\n+{(int)GetValue( level, Mod.MaxHp )} max hp\n[-]+{(int)GetValue( level, Mod.Scale, true )}%[/-] size\nhealthpack hurt you instead of healing",
			descriptionLineHeight: 9.5f,
			descriptionImageSize: 17f
		);
	}

	public override void Start()
	{
		base.Start();
	}

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

		// todo: ?
		// not needed because of Weight?
		//Player.Modify( this, PlayerStat.PushStrength, GetValue( Level, Mod.PushStrength ), ModifierType.Add ); 

		Player.Modify( this, PlayerStat.MaxHp, GetValue( Level, Mod.MaxHp ), ModifierType.Add );
		Player.Modify( this, PlayerStat.Scale, GetValue( Level, Mod.Scale ), ModifierType.Mult );
		Player.Modify( this, PlayerStat.HealthPacksHurt, 1f, ModifierType.Add );

		Player.SetScale( Player.Stats[PlayerStat.Scale] );
		Player.SetWeight( 8f );
	}

	private static float GetValue( int level, Mod mod, bool isPercent = false )
	{
		switch ( mod )
		{
			case Mod.PushStrength:
			default:
				return 3000f;
			case Mod.Scale:
				return isPercent
					? 25f
					: 1f + 0.25f;
			case Mod.MaxHp:
				return 80f;
		}
	}

	public override void Remove( bool restart = false )
	{
		base.Remove( restart );

		Player.SetScale( Player.Stats[PlayerStat.Scale] );
		Player.SetWeight( 1f );
	}
}