A rare perk class that increases a player's healing effectiveness. It registers the perk metadata (name, icon, descriptions) and applies a multiplicative modifier to the player's HealEffectiveness stat based on perk level.
using System;
using Sandbox;
[Perk( Rarity.Rare, alwaysOfferDebug: false )]
public class PerkHealEffectiveness : Perk
{
private enum Mod { HealEffectiveness };
static PerkHealEffectiveness()
{
Register<PerkHealEffectiveness>(
name: "Improved Healing",
imagePath: "textures/icons/vector/heal_effectiveness.png",
description: level => $"+{GetValue( level, Mod.HealEffectiveness, true )}% healing received",
upgradeDescription: level => $"+{GetValue( level - 1, Mod.HealEffectiveness, true )}%→{GetValue( level, Mod.HealEffectiveness, true )}% healing received"
);
}
public override void Start()
{
base.Start();
}
public override void Refresh()
{
base.Refresh();
Player.Modify( this, PlayerStat.HealEffectiveness, GetValue( Level, Mod.HealEffectiveness ), ModifierType.Mult );
}
private static float GetValue( int level, Mod mod, bool isPercent = false )
{
switch ( mod )
{
case Mod.HealEffectiveness:
default:
switch(level)
{
case 1: default: return isPercent ? 10f : 1f + 0.1f;
case 2: return isPercent ? 15f : 1f + 0.15f;
case 3: return isPercent ? 20f : 1f + 0.20f;
case 4: return isPercent ? 25f : 1f + 0.25f;
case 5: return isPercent ? 30f : 1f + 0.30f;
}
//return isPercent
// ? 6f + 4f * level
// : 1f + (0.06f + 0.04f * level);
}
}
}