This repository was archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog.py
More file actions
501 lines (419 loc) · 17.6 KB
/
Copy pathcatalog.py
File metadata and controls
501 lines (419 loc) · 17.6 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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
from random import choice
import graphical
import libtcodpy as libtcod
SLOTLIST = ['head',
'hands',
'chest',
'main hand',
'off hand',
'amulet',
'left ring',
'right ring',
'back',
'feet']
FULL_STATUSEFFECTLIST = ['maim']
THROW_ITEMS = []
FULL_MONSTERLIST = ['starved mutt',
'mad hermit']
FULL_INAMELIST = ['healing salve',
'pipe gun',
'scrap metal sword',
'crude grenade',
'metal plate',
'goat leather sandals',
'kitchen knife',
'heavy broomstick',
"someone's memento",
'rebar blade',
'baseball bat',
'sharpened stick',
'chalk']
FULL_RACELIST = ['human',
'anime catgirl',
'placeholder2',
'placeholder',
'placeholder',
'placeholder',
'placeholder',
'placeholder']
FULL_GCLASSLIST = ['warden',
'placeholder1',
'placeholder2']
salve_adjs= ['red',
'blue',
'green',
'brown',
'purple',
'disgusting',
'pink',
'rainbow-coloured',
'dull',
'pale',
'milky',
'white',
'sticky',
'golden',
'black',
'smelly',
'flowery',
'bronze',
'metallic',
'shining',
'swirling',
'liquid',
'rubbery',
'nearly solid',
'watery',
'vibrant',
'dry',
'greenish',
'blueish',
'sickly',
'heavy',
'fuming',
'steaming',
'silvery',
'crusty',
'flaky',
'slowly bubbling',
'hot',
'sizzling',
'cold',
'orange',
'moldy'
]
gadget_adjs = ['striped',
'plastic',
'red',
'blue',
'green',
'brown',
'purple',
'pink',
'yellow',
'orange',
'rusted',
'moldy',
'golden',
'silvery',
'bronze',
'shiny',
'polished',
'old',
'decayed',
'scratched',
'scuffed',
'stained',
'bent',
'dirty',
'glossy',
'matte',
'gleaming',
'corroded',
'worn',
'rainbow-coloured',
'antiquated',
'spotless'
]
class EqSpecial:
def __init__(self, owner, enchantlist = []):
self.owner = owner
self.enchantlist = get_native_enchants(self)
def get_all_enchant_types(self):
full_list = []
for enchant in enchantlist:
full_list += enchant.typelist
return list(set(full_list))
#equipment special system explanation:
#GameObj is created. if the gameobj's name is found in catalog.fullinamelist, the __init__ method calls get_item_components, adding equipment or item + equipment components to itself
#in case it is an equipment, the equipment component further calls add_base_specials, adding an EqSpecial (that might be empty) to the equipment
#each 'enchantment' in a weapon is one instance of EnchantModule in that weapon's EqSpecial, which is in Equipment, which is in GameObj
#at the moment I only have 'native' enchantments in weapons, which are gonna be pretty much fixed, but it should be quite easy to generate random enchantments and such with this system
#although I will need to add a depth level rating of some sort to them at some point
class EnchantModule(object):
def __init__(self, owner, name, value, isnative = False, duration = 0):
self.isnative = isnative
self.owner = owner
self.name = name
self.value = value
self.duration = duration
self.typelist = []
self.get_typelist()
def get_typelist(self):
typelist = []
if self.name == 'str bonus':
self.typelist.append('on atk bonus')
elif self.name == 'maim chance':
self.typelist.append('on atk bonus')
self.typelist.append('status applier')
elif self.name == 'multiattack':
self.typelist.append('on atk bonus')
elif self.name == 'stun chance':
self.typelist.append('on atk bonus')
self.typelist.append('status applier')
class SkillNode(object):
def __init__(self, name, tier, leveled, abilities, description, parent):
self.name = name
self.tier = tier
self.leveled = leveled
self.abilities = abilities
self.description = description
self.parent = parent
def levelup(self):
self.leveled = True
if self.owner.level < self.tier:
self.owner.level = self.tier
def get_nodetable(treename): #only happens in initialization of skill tree (ctree, ttree, rtree, ptree)
if treename == 'combat':
nodetable = [
SkillNode(name = 'basic training', tier = 1, leveled = False, abilities = ['sprint', 'kicklaunch'], description = get_node_description('basic training'), parent = []),
SkillNode(name = 'heavy blades', tier = 2, leveled = False, abilities = [], description = get_node_description('heavy blades'), parent = ['basic training'])
]
elif treename == 'tech':
nodetable = [
SkillNode(name = 'basic engineering', tier = 1, leveled = False, abilities = [], description = get_node_description('basic engineering'), parent = [])
]
elif treename == 'ritual':
nodetable = [
SkillNode(name = 'basic ritualism', tier = 1, leveled = False, abilities = ['consume trinket', 'fling trinket'], description = get_node_description('basic ritualism'), parent = [])
]
elif treename == 'perks':
nodetable = [
SkillNode(name = 'shield focus', tier = 1, leveled = False, abilities = [], description = get_node_description('shield focus'), parent = [])
]
return nodetable
def get_glyphs(level):
glyphlist = []
if level >= 1:
glyphlist.append('damage glyph')
glyphlist.append('damage over time glyph')
glyphlist.append('slow glyph')
return glyphlist
def get_node_description(node):
descdict = {
'heavy blades':["KILL WITH BIG METAL STICK PLACEHOLDER PLACEHOLDER", 'test test test'],
'basic training':['you can kill people better with your hands', 'Allows sprinting.'],
'shield focus':["You become proficient in the use of shields.", 'All armour and dodge bonuses granted by shields are increased by 50%.'],
'basic ritualism':['Basic training in The Mysteries', 'Allows use of trinkets and drawing of ritualistic sigils and glyphs.'],
'basic engineering':['Basic training in the mysteries of machines', 'more stuff later']
}
description = descdict.get(node, 'default text')
return description
def get_status_startfunction(status):
if status.name == 'maim':
return graphical.FloatingText(status.affected.owner, status.name, libtcod.violet)
def get_status_stepfunction(status):
pass
def get_native_enchants(eqspecial): #must return list of EnchantModule objects
nativelist = []
eqname = eqspecial.owner.owner.name
# eqspecial.equipment.gameobj.name
if eqname == "rebar blade":
nativelist.append(EnchantModule(eqspecial, 'str bonus', 0.45, True))
nativelist.append(EnchantModule(eqspecial, 'maim chance', 0.3, True, duration = 30))
elif eqname == 'scrap metal sword':
nativelist.append(EnchantModule(eqspecial, 'str bonus', 0.25, True))
nativelist.append(EnchantModule(eqspecial, 'maim chance', 0.25, True, duration = 20))
elif eqname == 'kitchen knife':
nativelist.append(EnchantModule(eqspecial, 'multiattack', 0.25, True))
elif eqname == 'baseball bat':
nativelist.append(EnchantModule(eqspecial, 'str bonus', 0.4, True))
nativelist.append(EnchantModule(eqspecial, 'stun chance', 0.1, True, duration = 1))
elif eqname == 'sharpened stick':
nativelist.append(EnchantModule(eqspecial, 'polearm reach', 0.3, True))
nativelist.append(EnchantModule(eqspecial, 'polearm defense', 0.25, True))
return nativelist
##should replace these stupid if things with somethign better soon, dicts or something
def ccreation_description(choice):
descdict = {
'empty':' ',
'human':'A race that once thrived, now driven to the brink of slow destruction. Mostly content to be farmers and traders, although some rare enterprising souls take the sword and venture out. placeholder placeholder placeholder placeholder',
'warden' : 'generic warrior barbarian, at least until i think about the lore a wee bit lads',
'anime catgirl': 'kyaa kawaii nyan'
}
description = descdict.get(choice,'default text')
return description
def ccreation_stats(choice):
statdict = {
'empty':[' '],
'human': ['this is the human statblock', 'it comes as strings in a list'],
'warden' : ['more to combat','more to strength', 'more to constitution', 'decent starting weapons'],
'anime catgirl': ['we','are', 'here', 'for', 'test', 'purposes']
}
stats = statdict.get(choice, ['default text'])
return stats
def random_salve_name(salve):
global salve_adjs
if 0 < salve.depth_level <= 4:
adjnum = 1
elif 4 < salve.depth_level <= 9:
adjnum = 2
else: adjnum = 3
adjlist = []
for index in range(adjnum):
adj = choice(salve_adjs)
adjlist.append(adj)
salve_adjs.remove(adj)
name = 'a ' + ', '.join(adjlist) + ' salve'
return name
def random_gadget_name(gadget):
global gadget_adjs
if 0 < gadget.depth_level <= 4:
adjnum = 1
elif 4 < gadget.depth_level <= 9:
adjnum = 2
else: adjnum = 3
adjlist = []
for index in range(adjnum):
adj = choice(gadget_adjs)
adjlist.append(adj)
gadget_adjs.remove(adj)
name = 'a ' + ', '.join(adjlist) + ' ' + choice(['thingamajig', 'doodad', 'doohickey', 'thingamabob', 'gadget', 'device', 'gizmo', 'apparatus', 'contraption', 'widget'])
return name
def get_item_description(item):
if item.owner.name == 'scrap metal sword':
description = [
'Scrap metal sword',
'A sword made out of spare scrap metal.',
'Metal spurs protrude from the dull blade and veins of rust run across it.',
"Barely usable as a weapon, but still better than your fists. Just don't cut yourself."
]
if item.identified: description += [
'',
'Damage roll: ' + str(item.base_dmg[0]) + '-' + str(item.base_dmg[1]),
"Special: This item has a chance to maim on hit, severely impairing the target's movement.",
'Strength bonus: ' + str(item.special.on_atk_bonus['str bonus']*100) + '%%',
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'rebar blade':
description = [
'Rebar blade',
'A massive, thick piece of rebar, with one end sharpened into a blade.',
"The other end has a strap of leather tied around it, to protect the wielder's hand.",
"Quite heavy. You can't use it with only one hand."
]
if item.identified: description += [
'',
'Damage roll: ' + str(item.base_dmg[0]) + '-' + str(item.base_dmg[1]),
"Special: This item has a chance to maim on hit, severely impairing the target's movement.",
'Strength bonus: ' + str(item.special.on_atk_bonus['str bonus']*100) + '%%',
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'baseball bat':
description = [
'Baseball bat',
'A sturdy, plain wooden bat.',
"It may seem shoddy, but many heroes have used this as a weapon on the diamond over the years, bringing joy to millions.",
"A proper bash to the head can easily render one senseless. Two-handed."
]
if item.identified: description += [
'',
'Damage roll: ' + str(item.base_dmg[0]) + '-' + str(item.base_dmg[1]),
"Special: This item has a chance to stun on hit, rendering them defenseless for a short while.",
'Strength bonus: ' + str(item.special.on_atk_bonus['str bonus']*100) + '%%',
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'sharpened stick':
description = [
'Sharpened stick',
"It's a wonder this thing hasn't broken in half yet.",
"About on par with a caveman's weapon, but at least it gives you a reach advantage over the opponent.",
"Wave it around in front of yourself to appear quite threatening.",
]
if item.identified: description += [
'',
'Damage roll: ' + str(item.base_dmg[0]) + '-' + str(item.base_dmg[1]),
"Special: This item can attack at a 2 tile range, although it suffers a penalty attacking from normal melee range.",
"Special: Enemies must pass a check to approach you when you're wielding this weapon.",
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'heavy broomstick':
description = [
'Heavy broomstick',
"Repurposed heavy-duty cleaning implement, found in any supply closet.",
"What weapon more basic and classic could there be than a big, heavy stick?",
"Although the weapon itself is primitive, staves like it can be used in a variety of ways.",
]
if item.identified: description += [
'',
'Damage roll: ' + str(item.base_dmg[0]) + '-' + str(item.base_dmg[1]),
"Special: This item can be used with 3 stances. Use it from the (e)quipment menu to switch stances.",
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'kitchen knife':
description = [
'Kitchen knife',
"Ordinary light knife you'd find in any kitchen. This one is sharp and clean.",
"Not exactly made for combat, but it'll cut live flesh just as well as dead all the same."
]
if item.identified: description += [
'',
'Damage roll: ' + str(item.base_dmg[0]) + '-' + str(item.base_dmg[1]),
'Special: This item can multiattack.',
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'crude grenade':
description = [
'Crude grenade',
'placeholder'
]
elif item.owner.name == 'healing salve':
description = [
'Healing salve',
'placeholder'
]
elif item.owner.name == 'pipe gun':
description = [
'A crude pipe gun.',
'An explosive charge attached to the end of scavenged brass tubing,',
'which is in turn filled with nails and metal bits. Good for one use.',
'',
'Damage: 20',
'Range: 6',
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'goat leather sandals':
description = [
'Goat leather sandals.',
'More comfortable than cow leather, surprisingly.']
if item.identified: description += [
'',
'Dodge bonus: ' + str(item.equipment.dodge_bonus),
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'metal plate':
description = [
'Strapped metal plate.',
'A mishapen piece of flat metal with a strap, to hold on to.',
'Hurts your knuckles, but offers some protection when used as a shield.']
if item.identified: description += [
'',
'Armor bonus: ' + str(item.equipment.armor_bonus),
'Dodge bonus: ' + str(item.equipment.dodge_bonus),
'Weight: ' + str(item.weight)
]
elif item.owner.name == 'chalk':
description = [
'The most basic and plentiful drawing component.',
'Used for the drawing of sigils and doodles since time immemorial.',
'Chalk is cheap, easy to find and a single stick of it will last quite a while,',
'however, its power when it comes to evokation is rather lacking.',
'',
'Charges: ' + str(item.stack),
'Weight: '+ str(item.weight)
]
if item.itemtype == 'salve' and not item.identified:
description = [
'An unknown salve.',
'A strange gel-like substance inside a container.',
'Who knows what it could do?'
]
elif item.itemtype == 'gadget' and not item.identified:
description = [
'An unknown gadget.',
'Some kind of machine or tool, currently beyond your understanding.',
'Who knows what it could do?'
]
elif not item.identified:
description += ['', 'You know no details about this item.']
return description