using System;
namespace ODMO.Commons.Models.Digimon
{
public sealed partial class DigimonEvolutionSkillModel
{
///
/// Flag for expired buffs.
///
public bool Expired => DateTime.Now >= EndDate;
///
/// Remaining time in seconds.
///
public int RemainingSeconds
{
get
{
TimeSpan remainingTime = EndDate - DateTime.Now;
if (remainingTime.TotalSeconds > 0)
{
return (int)remainingTime.TotalSeconds;
}
return -1; // Return 0 if the remaining time is non-positive (i.e., if it's already expired).
}
}
///
/// Increases the current skill level.
///
/// Levels to increase
public bool IncreaseSkillLevel(byte levels = 1)
{
if (CurrentLevel == MaxLevel || CurrentLevel + levels > MaxLevel)
return false;
CurrentLevel += levels;
return true;
}
public void SetCooldown(int duration)
{
Duration = duration;
EndDate = DateTime.Now.AddSeconds(duration);
}
public void SetId(long id)
{
Id = id;
}
public void ResetCooldown()
{
Duration = 0;
EndDate = DateTime.MaxValue;
}
}
}