status/MoreChoicesStatus.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
[Status(3, 0, 1f, 0, false )]
public class MoreChoicesStatus : Status
{
public MoreChoicesStatus()
{
Title = "More Choices";
IconPath = "textures/icons/more_choices.png";
}
public override void Init(Player player)
{
base.Init(player);
}
public override void Refresh()
{
Description = GetDescription(Level);
Player.Modify(this, PlayerStat.NumUpgradeChoices, GetAddForLevel(Level), ModifierType.Add);
Player.Modify( this, PlayerStat.MaxHp, GetHealthMultForLevel( Level ), ModifierType.Mult );
if ( Player.Health > Player.Stats[PlayerStat.MaxHp] )
Player.Health = Player.Stats[PlayerStat.MaxHp];
}
public override string GetDescription(int newLevel)
{
return string.Format( "See {0} extra perk choice but reduce your max health by {1}%", GetAddForLevel(Level), GetHealthPercentForLevel( Level ) );
}
public override string GetUpgradeDescription(int newLevel)
{
return newLevel > 1 ? string.Format( "See {0}→{1} extra perk choices but reduce your max health by {2}%→{3}%", GetAddForLevel(newLevel - 1), GetAddForLevel(newLevel), GetHealthPercentForLevel( newLevel - 1 ), GetHealthPercentForLevel( newLevel ) ) : GetDescription(newLevel);
}
public float GetAddForLevel(int level)
{
return 1f * level;
}
public float GetHealthMultForLevel( int level )
{
return 1f - 0.05f * level;
}
public float GetHealthPercentForLevel( int level )
{
return 5 * level;
}
}