relics/RelicChocolate.cs
using Sandbox;
using System.Reflection.PortableExecutable;
using System.Runtime.Versioning;
using System.Threading.Tasks;
public class RelicChocolate : Relic
{
public override void LevelUp()
{
base.LevelUp();
int healAmount = 3;
int maxHPLoss = 1;
Manager.Instance.MaxHP = Math.Max( Manager.Instance.MaxHP - maxHPLoss, 1);
Manager.Instance.HP = Math.Min( Manager.Instance.HP + healAmount, Manager.Instance.MaxHP );
Manager.Instance.TimeSinceHPChanged = 0f;
var mouse = Mouse.Position;
var camera = Scene.Camera;
var ray = camera.ScreenPixelToRay( mouse );
var tr = Scene.Trace.Ray( ray, 10000f ).Run();
Manager.Instance.SpawnFloaterText(
pos: tr.EndPosition + new Vector3(0f, -20f, 0f),
text: $"-{maxHPLoss} Max HP",
emojiText: "",
lifetime: 2f,
color: new Color( 0.8f, 0f, 0f ),
velocity: new Vector2( 0f, -15f ),
deceleration: 2.1f,
fontSize: 40f,
startScale: 1f,
endScale: 1.1f
);
Manager.Instance.SpawnHealHPFloater( healAmount, tr.EndPosition );
Manager.Instance.PlaySfxCenter( "chocolate", volume: 0.85f, pitch: Game.Random.Float( 0.95f, 1.05f ) );
//Manager.Instance.Stats[StatType.TimerTotalTime] = Math.Max( 1f, Manager.Instance.Stats[StatType.TimerTotalTime] - 1f );
//Manager.Instance.TimeSinceTimerChanged = 0f;
}
}