SHOW:
|
|
- or go back to the newest paste.
| 1 | #This is just a basic example. More attributes would be added, of course | |
| 2 | - | from random import |
| 2 | + | from random import randint |
| 3 | ||
| 4 | #the attributes. For each stat, the value would be randomized respectivley | |
| 5 | health = "+"+str(randint(1, 10))+" Health" | |
| 6 | regen = "+"+str(randint(1, 30))+" Regen" | |
| 7 | atkspd = "+"+str(randint(1, 5))+" Attack Speed" | |
| 8 | attlist = [health, regen, atkspd] | |
| 9 | #I could go on, but I don't want to be here all day, it's just a quick example, after all | |
| 10 | ||
| 11 | #Possible Names | |
| 12 | first = ["Cleaver", "Sword", "Longsword", "Greatsword", "Shortsword", "Mace"] | |
| 13 | #the second, third, and fourth would be prefaced by all different strings. second is prefaced by "of" | |
| 14 | second = ["power", "strength", "sharpness", "kings"] | |
| 15 | #Third is prefaced by "of the", like it is from somewhere | |
| 16 | third = ["Vale", "Throne", "Slain", "king", "protectors of the realm", "Elves", "Dwarves"] | |
| 17 | #fourth is chosen instead of the first one, and gives names like "Kingslayer" or "Brisingr". Named swords will be more powerful | |
| 18 | fourth = ["Kingslayer", "Knightsbane", "Heart Eater", "Brisingr", "Vol Gul Mai"] | |
| 19 | ||
| 20 | #Function to choose a name | |
| 21 | def name(): | |
| 22 | output = "" | |
| 23 | x = randint(1, 3) | |
| 24 | if x==1: | |
| 25 | output = output + first[randint(0, len(first)-1)] + " of " + second[randint(0, len(second)-1)] | |
| 26 | elif x==2: | |
| 27 | output = output + first[randint(0, len(first)-1)] + " of the " + third[randint(0, len(third)-1)] | |
| 28 | elif x==3: | |
| 29 | output = output + fourth[randint(0, len(fourth)-1] | |
| 30 | return output | |
| 31 | def checklore(list, value): | |
| 32 | for x in list: | |
| 33 | if list[x] != value: | |
| 34 | return True | |
| 35 | else: | |
| 36 | return False | |
| 37 | def lore(): | |
| 38 | output = [] | |
| 39 | temp = "" | |
| 40 | random = randint(1, 10) | |
| 41 | #checks how many attributes the weapon will have | |
| 42 | for x in range(0, random): | |
| 43 | temp = randint[0, len(attlist)-1] | |
| 44 | if checklore(output, temp): | |
| 45 | output.append(temp) | |
| 46 | for b in output: | |
| 47 | output[b] = attlist[output[b]] | |
| 48 | return output | |
| 49 | #The weapons now! | |
| 50 | TOOL: | |
| 51 | name: name() | |
| 52 | lore: lore() | |
| 53 | chance: 50 |