status/CurseHurtLoseMaxHp.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
using static Sandbox.VertexLayout;

[Status(4, 0, 0.9f, 0, true )]
public class CurseHurtLoseMaxHp : Status
{
	private float _totalMaxHpLost;

	public CurseHurtLoseMaxHp()
    {
		Title = "Crippling Injuries";
		IconPath = "textures/icons/curse_hurt_lose_hp.png";
	}

	public override void Init( Player player )
	{
		base.Init(player);
	}

	public override void Refresh()
    {
		Description = GetDescription(Level);
	}

    public override string GetDescription(int newLevel)
    {
        return string.Format("When you're hurt for at least {0} dmg, lose 1 max HP", (int)GetThresholdForLevel( Level));
    }

    public override string GetUpgradeDescription(int newLevel)
    {
        return newLevel > 1 ? string.Format( "When you're hurt for at least {0}→{1} dmg, lose 1 max HP", (int)GetThresholdForLevel( newLevel - 1), (int)GetThresholdForLevel( newLevel)) : GetDescription(newLevel);
    }

    public override void OnHurt(float amount)
    {
        if ( amount >= GetThresholdForLevel(Level) )
        {
			_totalMaxHpLost += 1;

			Player.Modify( this, PlayerStat.MaxHp, -_totalMaxHpLost, ModifierType.Add );

			if ( Player.Health > Player.Stats[PlayerStat.MaxHp] )
				Player.Health = Player.Stats[PlayerStat.MaxHp];

			//Manager.Instance.SpawnFloaterParticle( Player.Position2D + new Vector2( 0f, 0.2f ), $"-{GetAmountForLevel( Level )} MAX HP", new Color( 1f, 0.4f, 0.4f ) );
		}
    }

	public float GetThresholdForLevel( int level )
	{
		switch(level)
		{
			case 1: default: return 15;
			case 2: return 10;
			case 3: return 5;
			case 4: return 1;
		}
	}
}