-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigimon.cs
More file actions
72 lines (63 loc) · 1.66 KB
/
Digimon.cs
File metadata and controls
72 lines (63 loc) · 1.66 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
namespace Cyber_Sleuth_Mod_Evolution_Analyzer
{
public class Digimon : IComparable
{
public readonly string ID;
public readonly string Name;
public readonly int Level;
public readonly int ModIndex;
public List<Tuple<int, string>> EvoConditions;
public Digimon(string id, string name, int level, int modindex, List<Tuple<int, string>> evoConditions)
{
ID = id;
Name = name;
Level = level;
ModIndex = modindex;
EvoConditions = evoConditions ?? ([]);
}
public Digimon()
{
ID = String.Empty;
Name = "TEMP";
Level = -1;
ModIndex = 0;
EvoConditions = [];
}
public override string ToString()
{
if (int.TryParse(ID, out _))
{
return Name + " [" + ID + "]";
}
else
{
return Name + " [" + ID.Substring(8);
}
}
public int CompareTo(object? obj)
{
if (obj == null)
{
return 0;
}
Digimon digimon = (obj as Digimon)!;
if (digimon.Level < Level)
{
return 1;
}
if (digimon.Level > Level)
{
return -1;
}
if (digimon.ModIndex < ModIndex)
{
return 1;
}
if (digimon.ModIndex > ModIndex)
{
return -1;
}
return (string.Compare(Name, digimon.Name));
}
}
}