-
Notifications
You must be signed in to change notification settings - Fork 0
/
Villager.vb
305 lines (245 loc) · 8.35 KB
/
Villager.vb
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
Public Class Villager
' Personal Information
Public ReadOnly Property UID As String
Public ReadOnly Property Name_F As String
Public ReadOnly Property Name_L As String
Public ReadOnly Property Age As Integer
Public Property DOD As Integer
Public Property MOY As Integer
' Occupation
Public Property Occupation As String
Public Property Competency As Integer ' Between 0 and 4
' Family Information
Public ReadOnly Property FatherUID As String
Public ReadOnly Property MotherUID As String
Public ReadOnly Property RelationshipList As List(Of String)
Public Property InRelationship As Boolean
' Pysical Description - Public
Public ReadOnly Property EyeColour As String
Public ReadOnly Property HairColour As String
Public ReadOnly Property HairLength As String
Public ReadOnly Property HairStyle As String
Public ReadOnly Property FaceShape As String
Public ReadOnly Property NoseShape As String
Public ReadOnly Property LipShape As String
Public ReadOnly Property SkinTone As String
' Pysical Description - Private
Private _Gender As Char
Private _BustPure As Integer
Private _weightInKg As Double
Private _heightInCm As Double
' Relationship Stats
Public ReadOnly Property SClass As SClasses 'homeless,poor,lower,middle,upper,rich,noble
Public ReadOnly Property Attrac As Integer 'between 1 and 10
Public ReadOnly Property SDrive As Integer 'between 0 and 100
Public ReadOnly Property Traits As New Traits
' Health
Public Property Health As Double ' Between 0 and 100
Public Property IsSickOrInjured As Boolean
Public Property YearsInjured As Integer
Public Property HasChronicIllness As Boolean
Public Property IsHungry As Boolean
Public Property YearsHungry As Integer
Public Property YearsHomeless As Integer
' Properties with proc
Public Property GenderChar As Char
Get
Return _Gender
End Get
Set(value As Char)
_Gender = value
End Set
End Property
Public Property BustPure As Integer
Get
Return _BustPure
End Get
Set(value As Integer)
_BustPure = value
End Set
End Property
Public Property WeightInKg As Double
Get
Return _weightInKg
End Get
Set(value As Double)
_weightInKg = value
End Set
End Property
Public Property HeightInCm As Double
Get
Return _heightInCm
End Get
Set(value As Double)
_heightInCm = value
End Set
End Property
<LiteDB.BsonIgnore>
Public ReadOnly Property Gender As (AsChar As Char, AsAAString As String, AsANString As String, AsPNouA As String, AsPNouB As String, AsPNouC As String)
Get
Dim Result, gString, PNounA, PNounB, PNounC As String
If _Gender = "m" Then
Result = "male"
PNounA = "his"
PNounB = "him"
PNounC = "he"
Else
Result = "female"
PNounA = "her"
PNounB = "her"
PNounC = "she"
End If
If Age <= AGroup.AgeGroup("Adolescent").MaxAge Then
gString = If(_Gender = "m", "boy", "girl")
Else
gString = If(_Gender = "m", "man", "woman")
End If
Return (_Gender, Result, gString, PNounA, PNounB, PNounC)
End Get
End Property
<LiteDB.BsonIgnore>
Public ReadOnly Property Bust As (pure As Integer, SDTag As String, CSize As String)
Get
Dim sdTag As String
Dim CupSize As String
sdTag = AGroup.GetBust(_BustPure)
Select Case _BustPure
Case 1
CupSize = "A"
Case 2
CupSize = "B"
Case 3
CupSize = "C"
Case 4
CupSize = "D"
Case Else
CupSize = ""
End Select
Return (_BustPure, sdTag, CupSize)
End Get
End Property
<LiteDB.BsonIgnore>
Public ReadOnly Property Weight As (SDTag As String, Metric As Double, Imperial As Double)
Get
Dim sdTag As String = AGroup.GetWeightRange(Age, _weightInKg)
Dim weightInPounds As Double = _weightInKg * 2.20462
Return (sdTag, _weightInKg, weightInPounds)
End Get
End Property
<LiteDB.BsonIgnore>
Public ReadOnly Property Height As (SDTag As String, Metric As Double, Imperial As Double)
Get
Dim sdTag As String = AGroup.GetHeightRange(Age, _heightInCm)
Dim heightInInches As Double = _heightInCm / 2.54
Return (sdTag, _heightInCm, heightInInches)
End Get
End Property
' Creating new Villagers
' For use with when a child is born in the village
Public Sub New(NewAge As Integer, NewGender As Char, NewFatherUID As String, NewMotherUID As String, NewSocialClass As Integer)
Name_L = GetRandomLastName()
UID = Guid.NewGuid().ToString("N").Substring(0, 8)
FatherUID = NewFatherUID
MotherUID = NewMotherUID
Age = NewAge
_Gender = NewGender
Name_F = GetRandomName(_Gender)
If Not _Gender = "m" Then
_BustPure = AGroup.GenerateBust(Age)
Else
_BustPure = -1
End If
_weightInKg = AGroup.GenerateWeight(Age)
_heightInCm = AGroup.GenerateHeight(Age)
EyeColour = GetRandomFeature(0)
If _Gender = "m" Then
HairLength = GetRandomFeature(1)
Else
HairLength = GetRandomFeature(2)
End If
HairColour = GetRandomFeature(3)
HairStyle = GetRandomFeature(4)
FaceShape = GetRandomFeature(5)
NoseShape = GetRandomFeature(6)
LipShape = GetRandomFeature(7)
SkinTone = GetRandomFeature(8)
Traits.RandomizeTraits()
SClass = NewSocialClass
Attrac = Math.Round(TruncNorm(AttractivenessMean, AttractivenessStdDev, AttractivenessMin, AttractivenessMax))
SDrive = RNGen(0, 100)
End Sub
' For use when a Villager moves in
Public Sub New(NewAge As Integer, NewGender As Char)
Me.New(NewAge, NewGender, "NONGIVEN", "NONGIVEN", -1)
SClass = Math.Round(TruncNorm(SocialClassMean, SocialClassStdDev, SocialClassMin, SocialClassMax))
End Sub
Public Sub New(NewAge As Integer)
Me.New(NewAge, "U")
_Gender = If(RNGen(1000) < 500, "m", "f")
End Sub
Public Sub New(NewGender As Char)
Me.New(-1, NewGender)
Age = RNGen(90)
End Sub
Public Sub New()
Me.New(-1, "U")
Age = RNGen(90)
_Gender = If(RNGen(1000) < 500, "m", "f")
End Sub
' Functions
Public Function GetCompetency() As CompetencyLevels
Dim Result As CompetencyLevels = Competency
If IsSickOrInjured Then
Result -= 1
End If
If IsHungry Then
Result -= 1
End If
Select Case Health
Case < StartingBaseHealth * 0.1
Result -= 2
Case < StartingBaseHealth * 0.5
Result -= 1
End Select
Return Result
End Function
Public Function AgeUp() As Boolean
Dim Result As Boolean = False
Dim LD As Double = HealthyLifeDrain
_Age += 1
If IsSickOrInjured Then
YearsInjured -= 1
If Not YearsInjured > 0 Then
IsSickOrInjured = False
Else
LD += (LD * 0.2)
End If
End If
If IsHungry Then
LD += (LD * 0.25)
YearsHungry += 1
Else
YearsHungry = 0
End If
If HasChronicIllness Then
LD += (LD * 0.3)
End If
If SClass = 0 Then
YearsHomeless += 1
Else
YearsHomeless = 0
End If
Health -= LD
If Health > 0 Then
Result = True
End If
Return Result
End Function
Public Sub AddRelationship(RelationshipUID As String)
InRelationship = True
RelationshipList.Add(RelationshipUID)
End Sub
Public Sub RemoveRelationship()
InRelationship = False
End Sub
End Class