-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.lua
More file actions
426 lines (422 loc) · 10.3 KB
/
Copy pathclasses.lua
File metadata and controls
426 lines (422 loc) · 10.3 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
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
objclasses={
pissecguard = {
char="S",
graphic="secguard",
color={0,0.6,0.9,1},
health=25,
atksound="pistol",
dice=3,
sides=4,
tohit=0.9,
shots=1,
xp=10,
movetime=12,
cooldown=1,
aggro=0.8,
range=9,
name="Security Guard",
desc="Simple security guard. Unarmored, lightly armed, and fortunately quite dumb.",
deathmsg="The Security Guard collapses.",
ammo="9mm",ammocount=12,drops={"m99pis","m99pis","secarm"}
},
shotsecguard = {
char="S",
graphic="secguard",
color={0,0.6,0.9,1},
health=25,
atksound="shotgun",
dice=3,
sides=4,
tohit=0.65,
shots=3,
xp=14,
movetime=12,
cooldown=2,
aggro=0.8,
range=8,
name="Security Guard",
desc="Simple security guard. Unarmored, lightly armed, and fortunately quite dumb.",
deathmsg="The Security Guard collapses.",
ammo="12ga",ammocount=4,drops={"sawnoff","sawnoff","secarm"}
},
secdog = {
char="s",
color={0,0.6,0.9,1},
health=10,
dice=4,
sides=4,
tohit=0.8,
shots=1,
xp=14,
movetime=6,
cooldown=2,
aggro=1,
range=1,
name="Security Dog",
desc="Aww, a doggy! Too bad it'll maul you to death if you let it. Sorry boy, you gotta go.",
deathmsg="The Security Dog falls to its side."
},
smgtacguard = {
char="R",
color={0.6,0.6,0.6,1},
health=50,
atksound="submachine",
dice=3,
sides=4,
tohit=0.6,
shots=3,
xp=24,
movetime=11,
cooldown=1,
aggro=0.75,
range=10,
name="Riot Guard",
desc="A riot guard, in riot guard armor. Wields some decent weaponry. Kill him and take it.",
deathmsg="The Riot Guard drops to the ground.",
ammo="9mm",ammocount=30,drops={"sm40smg","sm40smg","riotarm","secarm"}
},
rifletacguard = {
char="R",
color={0.6,0.6,0.6,1},
health=50,
atksound="rifle",
dice=5,
sides=4,
tohit=0.8,
shots=1,
xp=27,
movetime=11,
cooldown=1,
aggro=0.65,
range=10,
name="Riot Guard",
desc="A riot guard, in riot guard armor. Wields some decent weaponry. Kill him and take it.",
deathmsg="The Riot Guard drops to the ground.",
ammo="5mm",ammocount=15,drops={"sn730rifle","riotarm","secarm"}
},
riflemilguard = {
char="M",
color={0,0.5,0,1},
health=90,
atksound="rifle",
dice=5,
sides=4,
tohit=0.9,
shots=2,
xp=47,
movetime=9,
cooldown=1,
aggro=0.8,
range=10,
name="Militia Guard",
desc="This highly trained soldier will gladly show you to your grave. Armored, armed, and scary. Kill on sight.",
deathmsg="The Militia Guard hits the floor.",
ammo="5mm",ammocount=17,drops={"sn730rifle","sn730rifle","milarm","riotarm"}
},
shotmilguard = {
char="M",
color={0,0.5,0,1},
health=90,
atksound="shotgun",
dice=4,
sides=4,
tohit=0.85,
shots=3,
xp=54,
movetime=9,
cooldown=2,
aggro=0.7,
range=9,
name="Militia Guard",
desc="This highly trained soldier will gladly show you to your grave. Armored, armed, and scary. Kill on sight.",
deathmsg="The Militia Guard hits the floor.",
ammo="12ga",ammocount=6,drops={"ca12shotty","ca12shotty","milarm","riotarm"}
},
mildog = {
char="m",
color={0,0.5,0,1},
health=40,
dice=5,
sides=5,
tohit=0.9,
shots=1,
xp=30,
movetime=5,
cooldown=2,
aggro=1,
range=1,
name="Militia Dog",
desc="Puppy! Yeah, no. Better get to firing, cos you're not outrunning this pupper.",
deathmsg="The Militia Dog falls with a yelp."
},
gundrone = {
char="D",
color={0.4,0.4,0.4,1},
health=50,
atksound="rifle",
dice=4,
sides=5,
tohit=0.8,
shots=3,
xp=40,
movetime=5,
cooldown=1,
aggro=0.85,
range=8,
fly=true,
name="Gun Drone",
desc="Uh uh. Bad news. You need to take care of this thing before it takes care of you.",
deathmsg="The Gun Drone hits the ground with a satisfying crack."
},
shockdrone = {
char="d",
color={0.4,0.4,0.4,1},
health=50,
dice=6,
sides=4,
tohit=1.0,
shots=1,
xp=35,
movetime=5,
cooldown=0,
aggro=0.8,
range=1.4,
fly=true,
name="Shock Drone",
desc="It's fast, armored, and it has a taser. It's a taser attack drone. Who came up with this?",
deathmsg="The Shock Drone falls from the sky, still buzzing its taser."
},
gundronesmall = {
char="D",
color={0.7,0.7,0.7,1},
health=15,
atksound="sm41",
dice=3,
sides=4,
tohit=0.8,
shots=2,
xp=26,
movetime=5,
cooldown=1,
aggro=0.85,
range=6,
fly=true,
name="Lt.Gun Drone",
desc="Hear the whirring. Hear the swarm.",
deathmsg="The Drone falls."
},
shockdronesmall = {
char="d",
color={0.7,0.7,0.7,1},
health=15,
dice=6,
sides=4,
tohit=1.0,
shots=1,
xp=21,
movetime=5,
cooldown=0,
aggro=0.7,
range=1.3,
fly=true,
name="Lt.Shock Drone",
desc="Hear the zapping. Hear the swarm.",
deathmsg="The Drone falls."
},
turret1 = {
char="t",
color={0.4,0.4,0.4,1},
health=70,
atksound="submachine",
dice=3,
sides=4,
tohit=0.7,
shots=3,
xp=30,
movetime=18,
cooldown=0,
aggro=0.8,
range=11,
fly=true,
name="Defense Turret",
desc="Static ceiling mounted turret with a submachinegun.",
deathmsg="The turret stops tracking.",
ammo="9mm",ammocount=20,
nomoving = true
},
turret2 = {
char="T",
color={0.4,0.4,0.4,1},
health=100,
atksound="rifle",
dice=5,
sides=4,
tohit=0.8,
shots=2,
xp=40,
movetime=16,
cooldown=0,
aggro=0.8,
range=11,
fly=true,
name="Defense Turret",
desc="Static ceiling mounted turret with a rifle.",
deathmsg="The turret stops tracking.",
ammo="5mm",ammocount=15,
nomoving = true
},
protogunbot = {
char="B",
color={0.4,0.5,0.8,1},
health=140,
atksound="submachine",
dice=3,
sides=4,
tohit=0.85,
shots=3,
xp=150,
movetime=9,
cooldown=0,
aggro=0.75,
range=9,
name="Defense Bot",
desc="It appears to be a quadrupedal robot with a submachinegun bolted to it. It isn't running out of ammo any time soon either.",
deathmsg="The Defense Bot is destroyed! I hope to never see another."
},
gunbot = {
char="B",
color={0.5,1,0.6,1},
atksound="rifle",
health=200,
dice=5,
sides=5,
tohit=0.9,
shots=3,
xp=300,
movetime=9,
cooldown=0,
aggro=0.65,
range=10,
name="Defense Bot",
desc="I guess the last one was a prototype. This one has a rifle instead of a submachinegun! Frabjous day.",
deathmsg="The Defense Bot falls! That better be the last one."
},
eliteguard = {
char="E",
color={1,1,1,1},
health=180,
atksound="rifle",
dice=5,
sides=5,
tohit=1.1,
shots=2,
xp=71,
movetime=7,
cooldown=1,
aggro=0.7,
range=11,
name="Elite Guard",
desc="These guys are guarding the deep research facility. Unfortunate.",
deathmsg="The Elite Guard breaths its last breath.",
ammo="5mm",ammocount=22,drops={"sn730rifle","sn730rifle","milarm","milarm","balarm"}
}
}
function makeObj(classname,ox,oy)
local o={pox=ox,poy=oy}
local c=objclasses[classname]
if c==nil then print("invalid object classname!");mkHudmessage("invalid object classname!");return end
o.char=c.char--the character representing the obj
if c.graphic==nil then
print(classname.." graphic nil")
end
o.graphic=c.graphic--the graphical icon for the obj
o.color=c.color--the color of said char
o.health=c.health
o.atksound=c.atksound--sound made when the obj attacks
o.dice=c.dice--number of dice in the obj's attack
o.sides=c.sides--sides per die
o.tohit=c.tohit--chance to hit (point blank)
o.shots=c.shots--number of shots per attack
o.xp=c.xp--xp awarded on kill
o.movetime=c.movetime--how many turns of the player's for every one of the obj's turns
o.turncounter=love.math.random(0,1)--how many turns since the obj's last turn, for counting the above
o.attacksteps=1--how many steps the obj must take before attacking
o.cooldown=c.cooldown--what to reset attacksteps to after an attack
o.aggro=c.aggro--the chance (0 to 1.0) for the obj to attack if it can
o.range=c.range--attack range of the enemy
o.fly=c.fly--if fly is true they move freely over acid
o.nomoving=c.nomoving--self explanatory, object cannot move
o.name=c.name--displayed on the info screen and when hovered
o.desc=c.desc--same as above
o.deathmsg=c.deathmsg--message displayed when you kill the object
o.chasing=false--if false the object will roam aimlessly. set to true if the object can see the player.
--drops
o.ammo=c.ammo
o.ammocount=c.ammocount
o.drops=c.drops
o.id=#eObjs+1
if gameskill>2 then o.health = (o.health + 1) * 1.1 end
if gameskill>3 then o.health = o.health * 1.1 end
o.maxhealth=o.health
table.insert(eObjs,o)
enemies = enemies + 1
end
function makeFlrObj(char,graphic,color,ox,oy)
print("made flr obj")
local foat = objat(ox,oy,fObjs)
if foat~=-1 then
fObjs[foat].char = char
fObjs[foat].graphic = graphic
fObjs[foat].color = color
return
end
local o={pox=ox,poy=oy}
o.char=char
o.graphic=graphic
o.color=color
o.id=#fObjs+1
table.insert(fObjs,o)
end
function killObj(oid)
local o = eObjs[oid]
pscore = (pscore + (o.xp*3) - pObj.pain) + 16
if gameskill==1 then o.xp = math.floor(o.xp*0.8) else
if gameskill==2 then o.xp = math.floor(o.xp*0.9) end
end
pObj.xp = pObj.xp + o.xp
if pObj.xp>=pObj.lv*70-20 then
playerLvUp()
end
makeFlrObj("%","corpse",{o.color[1]*0.4,o.color[2]*0.4,o.color[3]*0.4,o.color[4]},o.pox,o.poy)
if (love.math.random()<0.7 or gameskill<3) and o.ammo~=nil then
if love.math.random()<0.7 then
--drop ammo
local amt = love.math.random(2,o.ammocount)
makeAmmoObj(o.ammo,amt,o.pox,o.poy)
else
--drop a random item
if o.drops~=nil then
local drop = o.drops[love.math.random(1,#o.drops)]
local maxcounts = {
m99pis = 12,
sawnoff = 2,
sm40smg = 30,
ca12shotty = 6,
sn730rifle = 30,
secarm = 60,
riotarm = 70,
milarm = 100,
balarm = 150
}
makeItemObj(drop,love.math.random(1,maxcounts[drop]),o.pox,o.poy)
end
end
end
kills = kills + 1
localenemycount = localenemycount - 1
if localenemycount == 0 then
pscore = pscore + 50
mkHudmessage("With the "..o.name.."'s death, all is peaceful.",{0.2,0.2,1.0,1.0})
end
--eObjs[oid]=nil
end