-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorld.cs
198 lines (180 loc) · 4.86 KB
/
World.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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClanCreatorApp
{
public class World
{
public static string[] springWeather =
{
"Clear",
"Sunny",
"Cloudy",
"Partially Cloudy",
"Drizzly",
"Foggy",
"Misty",
"Light Rain",
"Light Rain",
"Heavy Rain"
};
public static string[] summerWeather =
{
"Clear",
"Sunny",
"Clear",
"Sunny",
"Clear",
"Sunny",
"Cloudy",
"Partially Cloudy",
"Partially Cloudy",
"Partially Cloudy",
"Drizzly",
"Foggy",
"Misty",
"Light Rain",
"Heavy Rain"
};
public static string[] fallWeather =
{
"Clear",
"Sunny",
"Cloudy",
"Clear",
"Sunny",
"Cloudy",
"Partially Cloudy",
"Drizzly",
"Foggy",
"Misty",
"Light Rain",
"Heavy Rain",
"Frosty"
};
public static string[] winterWeather =
{
"Clear",
"Sunny",
"Cloudy",
"Cloudy",
"Partially Cloudy",
"Light Snow",
"Heavy Snow",
"Frosty",
"Misty",
"Light Snow",
"Heavy Snow",
"Frosty"
};
public enum Season
{
Newleaf,
Greenleaf,
LeafFall,
Leafbare
};
public static Dictionary<Season, string> seasons = new Dictionary<Season, string>()
{
{Season.Newleaf, "Newleaf" },
{Season.Greenleaf, "Greenleaf" },
{Season.LeafFall, "Leaf-fall" },
{Season.Leafbare, "Leafbare" }
};
public static Season GetSeason(int day)
{
while(day > 360)
{
day -= 360;
}
if(day <= 90)
{
return Season.Newleaf;
}
else if(day <= 180)
{
return Season.Greenleaf;
}
else if(day <= 270)
{
return Season.LeafFall;
}
else
{
return Season.Leafbare;
};
}
public static float PreyChance(Season s)
{
switch(s)
{
case Season.Newleaf:
return 1.5f;
case Season.Greenleaf:
return 1f;
case Season.LeafFall:
return .75f;
case Season.Leafbare:
return .25f;
default:
return -1f;
}
}
public static float PreyDC(Season s)
{
switch (s)
{
case Season.Newleaf:
return 4;
case Season.Greenleaf:
return 5;
case Season.LeafFall:
return 9;
case Season.Leafbare:
return 12f;
default:
return -1f;
}
}
public static string GetRandomWeather(Season s)
{
Random rand = new Random(Utils.GetRandom());
switch (s)
{
case Season.Newleaf:
return springWeather[rand.Next(0, springWeather.Length)];
case Season.Greenleaf:
return summerWeather[rand.Next(0, summerWeather.Length)];
case Season.LeafFall:
return fallWeather[rand.Next(0, fallWeather.Length)];
case Season.Leafbare:
return winterWeather[rand.Next(0, winterWeather.Length)];
default:
return "Error";
}
}
}
public struct WorldStatus
{
public string saveName;
public int day;
public World.Season season;
public string weather;
public WorldStatus(string name)
{
saveName = name;
day = 1;
season = World.GetSeason(day);
weather = World.GetRandomWeather(season);
}
public WorldStatus(string name, int day1, string w)
{
saveName = name;
day = day1;
season = World.GetSeason(day);
weather = w;
}
}
}