A Status class for a player ability called "Wild Fire" that increases the chance ignited fires spread on touch. It sets title and icon, applies a stat modifier to the player when refreshed, and provides description and upgrade text based on level.
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
[Status( 4, 0, 1f, 0, false, typeof( FireIgniteStatus ), typeof( DashFireStatus ) )]
public class FireSpreadStatus : Status
{
public FireSpreadStatus()
{
Title = "Wild Fire";
IconPath = "textures/icons/fire_spread.png";
}
public override void Init( Player player )
{
base.Init( player );
}
public override void Refresh()
{
Description = GetDescription( Level );
Player.Modify( this, PlayerStat.FireSpreadChance, GetAddForLevel( Level ), ModifierType.Add );
}
public override string GetDescription( int newLevel )
{
return string.Format( "{0}% chance for your ignited fires to spread on touch", GetPercentForLevel( Level ) );
}
public override string GetUpgradeDescription( int newLevel )
{
return newLevel > 1 ? string.Format( "{0}%→{1}% chance for your ignited fires to spread on touch", GetPercentForLevel( newLevel - 1 ), GetPercentForLevel( newLevel ) ) : GetDescription( newLevel );
}
public float GetAddForLevel( int level )
{
return 0.01f + 0.08f * level + (level == 4 ? 0.04f : 0f);
}
public float GetPercentForLevel( int level )
{
return 1 + 8 * level + (level == 4 ? 4 : 0);
}
}