PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Libraries/Gen7MiscLibrary.cs

38 lines
1.2 KiB
C#

using System.Collections.Generic;
using PkmnLib.Dynamic;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Static;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Libraries;
public class Gen7MiscLibrary : IMiscLibrary
{
private readonly IMoveData _struggleData = new MoveDataImpl("struggle", new TypeIdentifier(0),
MoveCategory.Physical, 50,
255, 255, MoveTarget.Any, 0,
new SecondaryEffectImpl(-1, "struggle", new Dictionary<StringKey, object>()), []);
/// <inheritdoc />
public ITurnChoice ReplacementChoice(IPokemon user, byte targetSide, byte targetPosition) =>
new MoveChoice(user, new LearnedMoveImpl(_struggleData, MoveLearnMethod.Unknown), targetSide,
targetPosition);
/// <inheritdoc />
public TimeOfDay GetTimeOfDay()
{
var time = StaticHelpers.GetCurrentDateTime();
var hour = time.Hour;
return hour switch
{
>= 0 and <= 5 => TimeOfDay.Night,
>= 6 and <= 9 => TimeOfDay.Morning,
>= 10 and <= 16 => TimeOfDay.Day,
17 => TimeOfDay.Evening,
_ => TimeOfDay.Night
};
}
}