-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathUnlockCondition.cs
46 lines (39 loc) · 1.2 KB
/
UnlockCondition.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Newtonsoft.Json;
using Shockah.Kokoro.Stardew;
using StardewValley;
using System;
namespace Shockah.EarlyGingerIsland;
public struct UnlockCondition : IComparable<UnlockCondition>
{
public int Year { get; set; }
public int SeasonIndex { get; set; }
public int DayOfMonth { get; set; }
public int HeartsWithWilly { get; init; }
[JsonIgnore]
public readonly WorldDate Date
=> WorldDateExt.New(Year, SeasonIndex, DayOfMonth);
public UnlockCondition(int year, int seasonIndex, int dayOfMonth, int heartsWithWilly)
{
this.Year = year;
this.SeasonIndex = seasonIndex;
this.DayOfMonth = dayOfMonth;
this.HeartsWithWilly = heartsWithWilly;
}
public UnlockCondition(WorldDate date, int heartsWithWilly)
: this(date.Year, date.SeasonIndex, date.DayOfMonth, heartsWithWilly)
{
}
public readonly void Deconstruct(out WorldDate date, out int heartsWithWilly)
{
date = Date;
heartsWithWilly = HeartsWithWilly;
}
public readonly int CompareTo(UnlockCondition other)
{
if (Date.TotalDays != other.Date.TotalDays)
return Date.TotalDays.CompareTo(other.Date.TotalDays);
if (HeartsWithWilly != other.HeartsWithWilly)
return HeartsWithWilly.CompareTo(other.HeartsWithWilly);
return 0;
}
}