status/CurseRerollDmg.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
using static Sandbox.VertexLayout;
[Status( 3, 0, 0.4f, 0, true )]
public class CurseRerollDmg : Status
{
public CurseRerollDmg()
{
Title = "Gambling Addiction";
IconPath = "textures/icons/curse_reroll_dmg.png";
}
public override void Init( Player player )
{
base.Init( player );
}
public override void Refresh()
{
Description = GetDescription( Level );
}
public override void OnReroll()
{
base.OnReroll();
Player.Damage( GetAmountForLevel( Level ), PlayerDamageType.Self );
Manager.Instance.PlaySfxNearby( "zombie.attack.player", Player.Position2D, pitch: Game.Random.Float( 1.25f, 1.45f ), volume: 0.9f, maxDist: 3f );
}
public override string GetDescription( int newLevel )
{
return string.Format( "When you reroll, take {0} dmg", GetAmountForLevel( Level ) );
}
public override string GetUpgradeDescription( int newLevel )
{
return newLevel > 1 ? string.Format( "When you reroll, take {0}→{1} dmg", GetAmountForLevel( newLevel - 1 ), GetAmountForLevel( newLevel ) ) : GetDescription( newLevel );
}
public float GetAmountForLevel( int level )
{
return 5 + 15 * level;
}
}