A Status subclass that applies an "Early Boss" effect to a player. It sets title and icon, reduces the boss arrival time based on the status level, and provides description and upgrade text reflecting how many seconds earlier the boss will arrive.
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
[Status( 7, 0, 1f, 0, false )]
public class EarlyBossStatus : Status
{
public EarlyBossStatus()
{
Title = "Early Boss";
IconPath = "textures/icons/early_boss.png";
}
public override void Init( Player player )
{
base.Init( player );
}
public override void Refresh()
{
Description = GetDescription( Level );
Player.Modify( this, PlayerStat.BossArrivalTime, -GetAddForLevel( Level ), ModifierType.Add );
//var time = TimeSpan.FromSeconds( Player.Stats[PlayerStat.BossArrivalTime] );
//DataString = time.ToString( @"mm\:ss" );
}
public override string GetDescription( int newLevel )
{
return string.Format( "The boss arrives {0}s earlier", GetAddForLevel( Level ) );
}
public override string GetUpgradeDescription( int newLevel )
{
return newLevel > 1 ? string.Format( "The boss arrives {0}s→{1}s earlier", GetAddForLevel( newLevel - 1 ), GetAddForLevel( newLevel ) ) : GetDescription( newLevel );
}
public float GetAddForLevel( int level )
{
switch(level)
{
case 1: default: return 30f;
case 2: return 55f;
case 3: return 75f;
case 4: return 90f;
case 5: return 100f;
case 6: return 105f;
case 7: return 110f;
}
}
}