-
Notifications
You must be signed in to change notification settings - Fork 0
/
MagicModule.vb
348 lines (222 loc) · 8.71 KB
/
MagicModule.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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
Module MagicModule
Public Sub MagicAttack(ByRef intMagBonusRange As Integer, ByRef intMagBonusLow As Integer,
ByRef intAtkRange As Integer, ByRef intAttackLow As Integer)
'Generate random number for MagAtkBonus to range of numbers
intMagDamage = rand.Next(intMagBonusRange) + (intMagBonusLow)
'Generate random number for HeroAtk to range of numbers
intHeroAtk = rand.Next(intAtkRange) + (intAttackLow)
'Subtract the result of Hero plus MagBonus from Enemy HP
intEnemyHP -= (intHeroAtk + intMagDamage)
End Sub
Public Sub MagicHeal(ByRef intMagHealRange As Integer, IntMagHealLow As Integer)
'Generate random number starting at MagHealLow with a range of MagHealRange
'and assign to MagHeal variable
intMagHeal = rand.Next(intMagHealRange) + IntMagHealLow
If (intMagHeal + intHeroHP) > intHeroTotalHP Then
'Set MagHeal to the difference of HeroTotalHP and HeroHP
intMagHeal = intHeroTotalHP - intHeroHP
'If MagHeal is greater than HeroTotalHP, set to HeroTotalHP
intHeroHP = intHeroTotalHP
Else
'Add MagHeal to HeroHP
intHeroHP += intMagHeal
End If
End Sub
Public Sub TierIMagic()
If blnThunder = True Then
'Call MagicAttack sub from SubFunc module
Thunder()
If blnEnemyCanAtk = True Then
'If EnemyCanAtk is true then change DamageDesc string
'to Lightning
strDamageDesc = "LIGHTNING"
End If
End If
'If Heal bool is true then test hero MP
If blnHeal = True Then
'Call MagicHeal sub from SubFuncModule
Heal()
End If
End Sub
Public Sub Thunder()
'Select case for LvlCount
Select Case intLvlCount
Case 1
If intHeroMP >= 5 Then
'Subtract 5MP from HeroMP
intHeroMP -= 5
'Call MagicAttack sub
MagicAttack(3, 6, 8, 14)
'Set EnemyCanAtk bool to true
blnEnemyCanAtk = True
Else
'Call InsufficientMP sub
InsufficientMP()
End If
Case 2
If intHeroMP >= 10 Then
'Subtract 10MP from HeroMP
intHeroMP -= 10
'Call MagicAttack sub with multipliers used for parameters
MagicAttack(3 * Multipliers(1), 6 * Multipliers(1),
8 * Multipliers(1), 14 * Multipliers(1))
'Set EnemyCanAtk boolean to true
blnEnemyCanAtk = True
Else
'Call InsufficientMP sub
InsufficientMP()
End If
Case 3
If intHeroMP >= 15 Then
'Subtract 15MP from HeroMP
intHeroMP -= 15
'Call MagicAttack sub with multipliers used for parameters
MagicAttack(3 * Multipliers(3), 6 * Multipliers(3),
8 * Multipliers(3), 14 * Multipliers(3))
'Set EnemyCanAtk boolean to true
blnEnemyCanAtk = True
Else
'Call InsufficientMP sub
InsufficientMP()
End If
Case 4
If intHeroMP >= 15 Then
'Subtract 15MP from HeroMP
intHeroMP -= 15
'Call MagicAttack sub with multipliers used for parameters
MagicAttack(3 * Multipliers(3), 6 * Multipliers(3),
8 * Multipliers(3), 14 * Multipliers(3))
'Set EnemyCanAtkboolean to true
blnEnemyCanAtk = True
Else
'Call InsufficientMP sub
InsufficientMP()
End If
End Select
End Sub
Public Sub Heal()
Select Case intLvlCount
'Select Case for LvlCount
Case 1
If intHeroMP >= 5 Then
'Subtract 5MP from HeroMP
intHeroMP -= 5
'Call MagicHeal sub
MagicHeal(6, 26)
'Assign "Heal" to DamageDesc Label
strDamageDesc = "Heal"
Else
'Call InsufficientMP sub
InsufficientMP()
End If
Case 2
If intHeroMP >= 10 Then
'Subtract 10MP from HeroMP
intHeroMP -= 10
'Call MagicHeal sub with multipliers factored into
'parameters
MagicHeal(6 * Multipliers(1), 26 * Multipliers(1))
'Assign "Heal" to DamageDesc Label
strDamageDesc = "Heal"
Else
'Call InsufficientMP sub
InsufficientMP()
End If
Case 3
If intHeroMP >= 15 Then
'Subtract 10MP from HeroMP
intHeroMP -= 15
'Cal' MagicHeal sub with multipliers factored into
'parameteres
MagicHeal(6 * Multipliers(3), 26 * Multipliers(3))
'Assign "Heal" to DamageDesc Label
strDamageDesc = "Heal"
Else
'Call Insufficient MP sub
InsufficientMP()
End If
Case 4
If intHeroMP >= 15 Then
'Subtract 10MP from HeroMP
intHeroMP -= 15
'Cal' MagicHeal sub with multipliers factored into
'parameteres
MagicHeal(6 * Multipliers(3), 26 * Multipliers(3))
'Assign "Heal" to DamageDesc Label
strDamageDesc = "Heal"
Else
'Call Insufficient MP sub
InsufficientMP()
End If
End Select
End Sub
Public Sub TierIIMagic()
'If Poison bool is true..
If blnPoison = True Then
'Check if Hero has sufficient MP
If intHeroMP >= 5 Then
'Subtract 5 from HeroMP
intHeroMP -= 5
'Set PoisonCount to three
intPoisonCount = 3
'Set EnemyIsPoisoned to true
blnEnemyIsPoisoned = True
'Set EnemyCanAtk to true
blnEnemyCanAtk = True
Else
'Call InsufficientMP sub
InsufficientMP()
End If
End If
End Sub
Public Sub CheckPoison()
'Sub that checks enemy for poison
If blnEnemyIsPoisoned = True Then
'Call Poison Sub
Poison()
End If
End Sub
Public Sub Poison()
'Sub that poisons the enemy for three turns
'Select case to verify level
Select Case intLvlCount
Case 2
If intPoisonCount > 0 Then
'Generate random number between 5-10
'and assign to HeroAtk
intHeroAtk = rand.Next(6) + 6
'Subtract HeroAtk from EnemyHP
intEnemyHP -= intHeroAtk
'Subtract one from PoisonCount
intPoisonCount -= 1
End If
Case 3
If intPoisonCount > 0 Then
'Generate random number between 5-10
'and assign to HeroAtk
intHeroAtk = rand.Next(11) + 11
'Subtract HeroAtk from EnemyHP
intEnemyHP -= intHeroAtk
'Subtract one from PoisonCount
intPoisonCount -= 1
End If
Case 4
If intPoisonCount > 0 Then
'Generate random number between 5-10
'and assign to HeroAtk
intHeroAtk = rand.Next(21) + 21
'Subtract HeroAtk from EnemyHP
intEnemyHP -= intHeroAtk
'Subtract one from PoisonCount
intPoisonCount -= 1
End If
End Select
End Sub
Public Sub InsufficientMP()
'Show MessageBox error
MessageBox.Show("Not Enough Magic Points!")
'Set EnemyCanAtk booleon to False
blnEnemyCanAtk = False
End Sub
End Module