def npc(): ideal = 'ideal-' + random.choice( ('chaotic', 'evil', 'good', 'lawful', 'neutral', 'other')) for t in ('appearance', 'ability-high', 'talent', 'mannerism', 'interaction', ideal, 'bond', 'flaw-secret'): table = get_table('dmg/npcs/{}'.format(t)) print_table_roll(table)
def une(): nn_table = get_table('une/npc-noun') nm_table = get_table('une/npc-modifier') mv_table = get_table('une/npc-motivation-verb') mn_table = get_table('une/npc-motivation-noun') npc_noun = nm_table.roll()[1] npc_modifier = nn_table.roll()[1] npc_description = 'The NPC is {} {} {}'.format( a_an(npc_noun), npc_noun, npc_modifier, ) print(npc_description) noun_columns = [] motivations = [] while len(noun_columns) < 3: verb = mv_table.roll()[1] noun_roll, noun = mn_table.roll()[0:2] column = math.floor((noun_roll.number - 1) / 20) if column not in noun_columns: noun_columns.append(column) motivations.append((verb, noun)) print('\nwho wants to...\n') for verb, noun in motivations: print('{} {}'.format(verb, noun)) ideals = ['good', 'evil', 'lawful', 'chaotic', 'neutral', 'other'] tables = [ 'appearance', 'ability-high', 'talent', 'mannerism', 'interaction', 'ideal-{}'.format(random.choice(ideals)), 'bond', 'flaw-secret', ] [print_table_roll('dmg/npcs/{}'.format(table)) for table in tables]
def gather_table_roll_displays(t, ref_opts={}, unique_rolls=None, modifier=None, row=None, level=0, elements=None): if level > MAX_LEVEL: return (elements, None, None) if type(t) is str: t = get_table(t) if row is None: ignore = ref_opts.get('ignore') while True: row = t.roll(modifier) number = row[0].number valid = True if type(ignore) == int: valid = number != ignore elif type(ignore) == list: valid = number not in ignore if valid and unique_rolls is not None: valid = number not in unique_rolls unique_rolls.add(number) if valid: break roll, text, references, result_modifier = row if elements is None: elements = [] elements.append( TableRollDisplayElement([roll, text], [str(t.dice), t.title], level)) if references is not None: for ref in references: unique = ref.opts.get('unique', False) unique_rolls = set() if unique else None if config.DEBUG: print(ref.count) for _ in range(ref.count): gather_table_roll_displays(ref.identifier, ref_opts=ref.opts, unique_rolls=unique_rolls, elements=elements, level=level + 1) return (elements, roll, result_modifier)
def mountain_loot(): table_1 = get_table('dmg/treasure/hoard-1-loot') table_2 = get_table('dmg/treasure/hoard-2-loot') print_table_roll(table_1) print_table_roll(table_1) print_table_roll(table_1) print_table_roll(table_1) print_table_roll(table_1) print_table_roll(table_1) print_table_roll(table_1) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2) print_table_roll(table_2)
def settlement(): for t in ('race-relations', 'ruler-status', 'notable-traits', 'known-for', 'current-calamity'): table = get_table('dmg/settlements/{}'.format(t)) print_table_roll(table)
def villain(): for t in ('objective', 'method', 'weakness'): table = get_table('dmg/villains/{}'.format(t)) print_table_roll(table)
def random_dungeon(): table = get_table('dmg/dungeons/random/starting-area') print_table_roll(table)
def spells(): table = get_table('spells/level/0') print(table.description())
def treasure(): table = get_table('dmg/treasure/hoard-4-loot') # print(table.evaluate_text()) print_table_roll(table)