Code:
import random
INTRO = 'Your challenge is to roll a'
RACE = ['human', 2, 'troll', 1, 'high elf', 2, 'gray elf', 2, 'dark elf', 2, \
'dwarf', 2, 'gnome', 2, 'hurthling', 2, 'orc', 1, 'drakeling', 1]
OCCUPATION = ['wizard.', 1, 'archer.', 1, 'barbarian.', 1, 'necromancer.', 1, 'elementalist.', 1, \
'fighter.', 2, 'paladin.', 2, 'priest.', 2, 'monk.', 2, 'druid.', 2, 'beastfighter.', 2, \
'assassin.', 4, 'ranger.', 4, 'bard.', 4, 'healer.', 4, 'weaponsmith.', 4, \
'merchant.', 8, 'thief.', 8, 'mindcrafter.', 8, 'farmer.', 8]
QUEST_TYPE = ['return the cute puppy to the tiny girl', 1, 'kill', 2, 'find', 2, 'commit suicide in', 1]
QUEST_MONSTER = ['a mimic', 2, 'a rust monster', 2, 'a master swordsman', 2, 'a ratling duelist', 4]
QUEST_ITEM = ['an amulet of perserverance', 2, 'a mithril shield', 2, 'a mithril sword', 2, \
'a pair of mithril boots', 3]
LOCATION = ['the pyramid, \ndungeon level 3,', 4, 'GriffYard, \ndungeon level 2,', 3, \
'the tomb of the high kings, \ndungeon level 6,', 4, 'caverns of chaos, \ndungeon level 15,', 3]
TURN_COUNT = ['6000.', 4, '7000.', 3, '8000.', 2, '9000.', 1, '10000.', 1]
CRUEL_RESTRICTION = ['cruel restriction, you must drop all your \nitems in the wilderness on turn 1.', 4, \
'cruel restriction, you must pray until your \ninventory is cursed upon game start.', 5, \
'cruel restriction, you must pray until you are doomed upon game start.', 8, \
'cruel restriction, you must forego all armor \nfor 5000 turns, starting on game turn 1.', 6, \
'cruel restriction, you must forego melee attacks \nfor 5000 turns, starting on game turn 1.', 5]
RESTRICTION = ['restriction, you must drop all your \nfood in the wilderness upon game start.', 1, \
'restriction, you must kick the air until \nyour HPs are under 5 upon game start.', 1, \
'restriction, you must forego all armor \nfor 2000 turns, starting from game turn 1.', 3, \
'restriction, you must forego melee attacks \nfor 2000 turns, starting from game turn 1.', 2, \
'restriction, you must forego the detect traps skill.', 1]
class DETAILS():
"""storage for challenge details and points"""
DETAILS.race_points = 0
DETAILS.occupation_points = 0
DETAILS.turn_points = 0
DETAILS.monster_points = 0
DETAILS.item_points = 0
DETAILS.location_points = 0
DETAILS.quest_points = 0
DETAILS.restriction_points = 0
def Choose_Race():
RNG = random.randrange(0, 19, 2)
DETAILS.race = RACE[RNG]
DETAILS.race_points = RACE[RNG+1]
def Choose_Occupation():
RNG = random.randrange(0, 39, 2)
DETAILS.occupation = OCCUPATION[RNG]
DETAILS.occupation_points = OCCUPATION[RNG+1]
def Choose_Turns():
RNG = random.randrange(0, 9, 2)
DETAILS.turns = TURN_COUNT[RNG]
DETAILS.turn_points = TURN_COUNT[RNG+1]
def Choose_Monster():
RNG = random.randrange(0, 7, 2)
DETAILS.monster = QUEST_MONSTER[RNG]
DETAILS.monster_points = QUEST_MONSTER[RNG+1]
def Choose_Item():
RNG = random.randrange(0, 7, 2)
DETAILS.item = QUEST_ITEM[RNG]
DETAILS.item_points = QUEST_ITEM[RNG+1]
def Choose_Location():
RNG = random.randrange(0, 7, 2)
DETAILS.location = LOCATION[RNG]
DETAILS.location_points = LOCATION[RNG+1]
def Choose_Quest():
RNG = random.randrange(0, 7, 2)
DETAILS.quest = QUEST_TYPE[RNG]
DETAILS.quest_points = QUEST_TYPE[RNG+1]
def Choose_Restriction():
RNG = random.randrange(0, 5, 1)
if RNG == 0: # +4 if cruel restriction
RNG = random.randrange(0, 9, 2)
DETAILS.restriction = CRUEL_RESTRICTION[RNG]
DETAILS.restriction_points = CRUEL_RESTRICTION[RNG+1]
else:
RNG = random.randrange(0, 9, 2)
DETAILS.restriction = RESTRICTION[RNG]
DETAILS.restriction_points = RESTRICTION[RNG+1]
def Challenge():
Choose_Race()
Choose_Occupation()
Choose_Turns()
Choose_Restriction()
Choose_Quest()
print INTRO, DETAILS.race, DETAILS.occupation
if DETAILS.quest == 'return the cute puppy to the tiny girl':
print 'You must', DETAILS.quest, 'by turn count', DETAILS.turns
if DETAILS.quest == 'kill':
Choose_Monster()
print 'You must', DETAILS.quest, DETAILS.monster, 'by turn count', DETAILS.turns
if DETAILS.quest == 'find':
Choose_Item()
print 'You must', DETAILS.quest, DETAILS.item, 'by turn count', DETAILS.turns
if DETAILS.quest == 'commit suicide in':
Choose_Location()
print 'You must', DETAILS.quest, DETAILS.location, 'by turn count', DETAILS.turns
i = DETAILS.race_points + DETAILS.occupation_points + DETAILS.turn_points + DETAILS.monster_points + DETAILS.item_points + DETAILS.location_points + DETAILS.quest_points + DETAILS.restriction_points
print 'As a', DETAILS.restriction
print 'Your quest is worth', i, 'points.'
Challenge()