-
Notifications
You must be signed in to change notification settings - Fork 0
/
rune.py
280 lines (249 loc) · 9.43 KB
/
rune.py
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
import random
rune_talisman_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
master_rune_talisman_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
melee_weapon_category_list = ['1', '2', '2', '2', '3', '4', '5', '6', '7', '7', '7', '8', '8', '8', '8', '9', '10',
'11',
'12', '12', '13', '14', '15', '16', '17', '18', '18', '18', '18', '18', '19', '19', '19',
'19', '19', '19', '19', '18', '18', '20', '20', '20', '21', '21', '21', '21', '20']
rune_melee_weapon_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
master_rune_melee_weapon_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
rune_armour_list = [1, 2, 3, 4, 5, 6, 7]
master_rune_armour_list = [1, 2, 3, 4]
armour_category_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
armour_category_dict = {
'1': 'Mail Coif',
'2': 'Plate Helmet',
'3': 'Mail Shirt',
'4': 'Mail Coat',
'5': 'Sleeved Mail Shirt',
'6': 'Sleeved Mail Coat',
'7': 'Mail Leggings',
'8': 'Plate Greaves',
'9': 'Plate Arms',
'10': 'Breastplate'
}
rune_armour_dict = {
'1': '*Rune of Slowness',
'2': '*Curse Rune',
'3': 'Rune of Fortitude',
'4': 'Rune of Iron',
'5': 'Rune of Resistance',
'6': 'Rune of Shielding',
'7': 'Rune of Stone'
}
master_rune_armour_dict = {
'1': '*Master Rune of Misfortune',
'2': 'Master Rune of Adamant',
'3': 'Master Rune of Gromril',
'4': 'Master Rune of Steel'
}
rune_talisman_dict = {
'1': '*Curse Rune',
'2': '*Rune of Battle',
'3': '*Rune of Enemy Detection',
'4': '*Rune of Healing',
'5': '*Rune of Immolation',
'6': '*Rune of Kadrin',
'7': '*Rune of Light',
'8': '*Rune of Restoration',
'9': '*Rune of Signal',
'10': '*Rune of Silence',
'11': 'Rune of Fate',
'12': 'Rune of the Furnace',
'13': 'Rune of Luck',
'14': 'Rune of Spellbreaking',
'15': 'Rune of Spelleating',
'16': 'Rune of Warding',
'17': '*Rune of Slowness'
}
master_rune_talisman_dict = {
'1': 'Master Rune of Dismay',
'2': '*Master Rune of Vigour',
'3': '*Master Rune of Vitality',
'4': 'Master Rune of Balance',
'5': 'Master Rune of Kingship',
'6': 'Master Rune of Spellbinding',
'7': 'Master Rune of Spite',
'8': '*Master Rune of Misfortune',
'9': '*Master Rune of Taunting',
'10': '*Master Rune of Valaya'
}
melee_weapon_category_dict = {
'1': 'Buckler',
'2': 'Dagger',
'3': 'Cavalry Spear',
'4': 'Flail',
'5': 'Foil',
'6': 'Knuckle-duster',
'7': 'Great Sword',
'8': 'Great Axe',
'9': 'Halberd',
'10': 'Lance',
'11': 'Main Gauche',
'12': 'Morning Star',
'13': 'Quarterstaff',
'14': 'Rapier',
'15': 'Shield',
'16': 'Spear',
'17': 'Sword-breaker',
'18': 'Hand Axe',
'19': 'Long Sword',
'20': 'One-Handed Hammer',
'21': 'Great Hammer'
}
rune_melee_weapon_dict = {
'1': '*Rune of Frenzy',
'2': '*Rune of Parrying',
'3': '*Rune of Transformation',
'4': 'Rune of Cleaving',
'5': 'Rune of Fire',
'6': 'Rune of Fury',
'7': 'Rune of Grudges',
'8': 'Rune of Might',
'9': 'Rune of Striking',
'10': '*Rune of Cutting',
'11': '*Rune of Illusion',
'12': '*Curse Rune'
}
master_rune_melee_weapon_dict = {
'1': '*Master Rune of Slaying',
'2': 'Master Rune of Alaric the Mad',
'3': 'Master Rune of Breaking',
'4': 'Master Rune of Flight',
'5': 'Master Rune of Skalf Blackhammer',
'6': 'Master Rune of Snorri Spanglehelm',
'7': 'Master Rune of Swiftness',
'8': '*Master Rune of Smiting',
'9': '*Master Rune of Misfortune'
}
# this function picks a random object
# from the list, then takes the information from
# the corresponding dictionary
# entry.
def pick_armour():
category = armour_category_dict[str(random.choice(armour_category_list))]
object_id = '1'
name = 'Rune ' + category + ' ('
description = 'This armour has one or more runes inscribed. For those with a *, check the Rune document.'
source = 'ROS2'
page = '211'
rune_list = []
rune_list_final = []
rune_type = rune_chance()
if type(rune_type) == int:
while len(rune_list) < rune_type:
pick = random.choice(rune_armour_list)
if pick not in rune_list:
rune_list.append(pick)
for item in rune_list:
rune_list_final.append(rune_armour_dict[str(item)])
if '*Curse Rune' in rune_list_final:
rune_list_final = curse_rune(rune_list_final)
for item in rune_list_final:
name += item + ', '
name = name[:-2]
name += ')'
else:
master_rune = master_rune_armour_dict[str(random.choice(master_rune_armour_list))]
name += master_rune + ')'
final_object = [object_id, name, description, source, page]
return final_object
def pick_weapon():
category = melee_weapon_category_dict[random.choice(melee_weapon_category_list)]
object_id = '1'
name = 'Rune ' + category + ' ('
description = 'This weapon has one or more runes inscribed. For those with a *, check the Rune document.'
source = 'ROS2'
page = '211'
rune_list = []
rune_list_final = []
rune_type = rune_chance()
if type(rune_type) == int:
while len(rune_list) < rune_type:
pick = random.choice(rune_melee_weapon_list)
if pick not in rune_list:
rune_list.append(pick)
for item in rune_list:
rune_list_final.append(rune_melee_weapon_dict[str(item)])
if '*Curse Rune' in rune_list_final:
rune_list_final = curse_rune(rune_list_final)
for item in rune_list_final:
name += item + ', '
name = name[:-2]
name += ')'
else:
master_rune = master_rune_melee_weapon_dict[str(random.choice(master_rune_melee_weapon_list))]
if master_rune == '*Master Rune of Slaying':
slaying_runes_list = ['Chaotic Creatures', 'Dragons', 'Undead']
name += 'Master Rune of Slaying (' + random.choice(slaying_runes_list) + ')'
elif master_rune == 'Master Rune of Flight':
rune_of_flight_weapon_list = ['One-handed Hammer', 'Great Hammer']
name = random.choice(rune_of_flight_weapon_list) + ' (Master Rune of Flight)'
else:
name += master_rune + ')'
final_object = [object_id, name, description, source, page]
return final_object
def pick_talisman(category):
object_id = '1'
name = 'Rune ' + category + ' ('
description = 'This ' + category + ' has one or more runes inscribed. For those with a *, check the Rune document.'
source = 'ROS2'
page = '211'
rune_list = []
rune_list_final = []
rune_type = rune_chance()
if type(rune_type) == int:
while len(rune_list) < rune_type:
pick = random.choice(rune_talisman_list)
if pick not in rune_list:
rune_list.append(pick)
for item in rune_list:
rune_list_final.append(rune_talisman_dict[str(item)])
if '*Curse Rune' in rune_list_final:
rune_list_final = curse_rune(rune_list_final)
if '*Rune of Enemy Detection' in rune_list_final:
rune_list_final = enemy_detection(rune_list_final)
for item in rune_list_final:
name += item + ', '
name = name[:-2]
name += ')'
else:
master_rune = master_rune_talisman_dict[str(random.choice(master_rune_talisman_list))]
if master_rune == 'Master Rune of Dismay':
name = 'Rune Horn (Master Rune of Dismay)'
description = 'This horn has been engraved with the Master Rune of Dismay.'
elif master_rune == 'Master Rune of Kingship':
name = 'Crown of the Dwarven Kings'
description = 'This massive crown has been engraved with the Master Rune of Kingship.'
elif master_rune == '*Master Rune of Vigour':
name = 'Rune Sceptre (*Master Rune of Vigour)'
description = 'This sceptre has been engraved with the Master Rune of Vigour. See the Rune document.'
else:
name += master_rune + ')'
final_object = [object_id, name, description, source, page]
return final_object
def curse_rune(rune_list):
characteristic = ['WS', 'BS', 'S', 'T', 'Agi', 'Int', 'WP', 'Fel']
affected_characteristic = random.choice(characteristic)
for item in range(0, len(rune_list)):
if rune_list[item] == '*Curse Rune':
rune_list[item] = 'Curse Rune (' + affected_characteristic + ' -10)'
return rune_list
def enemy_detection(rune_list):
enemy = ['Greenskins', 'Daemons', 'Undead', 'Dragons', 'Dwarfs, Gnomes and Halflings', 'Elves',
'Giant Animals', 'Skaven', 'Giants', 'Ogres and Trolls', 'Werecreatures']
affected_enemy = random.choice(enemy)
for item in range(0, len(rune_list)):
if rune_list[item] == '*Rune of Enemy Detection':
rune_list[item] = '*Rune of Enemy Detection (' + affected_enemy + ')'
return rune_list
def rune_chance():
chance = random.randint(1, 100)
if chance <= 40:
return 1
elif chance <= 70:
return 2
elif chance <= 90:
return 3
elif chance <= 100:
return 'M'