def game_initialize(): global SURFACE_MAIN, GAME, CLOCK, FOV_CALCULATE, ASSETS #initalizes the main window in pygame pygame.init() pygame.key.set_repeat(200, 70) #set key repeat #SURFACE_MAIN = pygame.display.set_mode((constants.GAME_WIDTH,constants.GAME_HEIGHT)) SURFACE_MAIN = pygame.display.set_mode( (constants.MAP_WIDTH * constants.CELL_WIDTH, constants.MAP_HEIGHT * constants.CELL_HEIGHT)) GAME = obj_Game() CLOCK = pygame.time.Clock() pygame.display.set_caption('Test Game!') FOV_CALCULATE = True ASSETS = struc_Assets() #Name Gen via dorian lib libtcod.namegen_parse("data\\namegen\\jice_celtic.cfg") GAME.current_objects = [] #items gen_item((2, 2)) gen_item((2, 3)) gen_item((2, 4)) #enemies gen_enemy((15, 15)) gen_enemy((15, 16)) gen_player((1, 1))
def create_area(): libtcod.namegen_parse('language_data.txt') area_type = random.choice(["crypt", "castle"]) #make sure name isn't the same as it's confusing area_name_correct = False name_list = [] for area in AREA_LIST: name_list.append(area.name) while area_name_correct == False: area_name = libtcod.namegen_generate(area_type) if area_name not in name_list: area_name_correct = True area = Area(name=area_name, area_type=area_type, description="", levels=random.randint(5, 10), tags=[]) area_tags = [] if area_type == "crypt": area_tags = random.choice(["dark", "cursed"]) elif area_type == "castle": area_tags = random.choice(["dark", "cursed"]) area.tags = area_tags area.fill_encounter_list() return area
def CivGen(Races): #-------------------------------------------------------------------- * CIV GEN * ---------------------------------------------------------------------------------- Civs = [0 for x in range(INITIAL_CIVS)] for x in range(INITIAL_CIVS): libtcod.namegen_parse('namegen/jice_fantasy.cfg') Name = libtcod.namegen_generate('Fantasy male') libtcod.namegen_destroy () Name += "Empire" Race = Races[randint(0,NRaces-1)] Agression = randint(1,4) Type = randint(1,1) Color = libtcod.Color(randint(0,255),randint(0,255),randint(0,255)) #Initialize Civ Civs[x] = Civ(Race,Name,Agression,Type,Color) print '- Civs Generated -' return Civs
def CivGen( Races, Govern ): #-------------------------------------------------------------------- * CIV GEN * ---------------------------------------------------------------------------------- Civs = [] for x in range(CIVILIZED_CIVS): libtcod.namegen_parse('namegen/jice_fantasy.cfg') Name = libtcod.namegen_generate('Fantasy male') libtcod.namegen_destroy() Name += " Civilization" Race = Races[randint(0, len(Races) - 1)] while Race.Form != "civilized": Race = Races[randint(0, len(Races) - 1)] Government = Govern[randint(0, len(Govern) - 1)] Color = Palette[randint(0, len(Palette) - 1)] Flag = FlagGenerator(Color) #Initialize Civ Civs.append(Civ(Race, Name, Government, Color, Flag, 0)) for a in range(TRIBAL_CIVS): libtcod.namegen_parse('namegen/jice_fantasy.cfg') Name = libtcod.namegen_generate('Fantasy male') libtcod.namegen_destroy() Name += " Tribe" Race = Races[randint(0, len(Races) - 1)] while Race.Form != "tribal": Race = Races[randint(0, len(Races) - 1)] Government = GovernmentType("Tribal", "*PLACE HOLDER*", 2, 50, 0) Color = libtcod.Color(randint(0, 255), randint(0, 255), randint(0, 255)) Flag = FlagGenerator(Color) #Initialize Civ Civs.append(Civ(Race, Name, Government, Color, Flag, 0)) print '- Civs Generated -' return Civs
def namegenerator(): """Create a random male or female demon name and return it as a string.""" alphanumerics = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' choices = [] new_name = '' for i in range(0, libtcod.random_get_int(0, 2, 4)): choices.append(choice(alphanumerics)) try: libtcod.namegen_parse('libtcod-1.5.1/data/namegen/mingos_demon.cfg') if libtcod.random_get_int(0, 0, 1): return new_name.join(choices[i] for i in range(len(choices))) + '-' + libtcod.namegen_generate('demon male') else: return new_name.join(choices[i] for i in range(len(choices))) + '-' + libtcod.namegen_generate('demon female') except: print 'Cannot find name generator file. Is it in ./libtcod-1.5.1/data/namegen/mingos_demon.cfg ?'
def quick_start(): libtcod.namegen_parse('data/names.txt') game.player.gender = game.GENDER[libtcod.random_get_int(game.rnd, 0, len(game.GENDER) - 1)] game.player.race = game.RACES[libtcod.random_get_int(game.rnd, 0, len(game.RACES) - 1)] game.player.profession = game.CLASSES[libtcod.random_get_int(game.rnd, 0, len(game.CLASSES) - 1)] game.player.name = libtcod.namegen_generate(game.player.gender.lower()) while game.player.name.lower() in game.savefiles: game.player.name = libtcod.namegen_generate(game.player.gender.lower()) game.player.base_strength = game.BASE_STATS[game.player.race + game.player.profession][0] + libtcod.random_get_int(game.rnd, 0, 6) game.player.base_dexterity = game.BASE_STATS[game.player.race + game.player.profession][1] + libtcod.random_get_int(game.rnd, 0, 6) game.player.base_intelligence = game.BASE_STATS[game.player.race + game.player.profession][2] + libtcod.random_get_int(game.rnd, 0, 6) game.player.base_wisdom = game.BASE_STATS[game.player.race + game.player.profession][3] + libtcod.random_get_int(game.rnd, 0, 6) game.player.base_endurance = game.BASE_STATS[game.player.race + game.player.profession][4] + libtcod.random_get_int(game.rnd, 0, 6) game.player.base_karma = libtcod.random_get_int(game.rnd, 0, 20) starting_stats() return 'playing'
def loadObjectData(): '''LOAD OBJECT DATA reads the CFG files in the data folder to build dictionaries of monsters, items, and name generation data.''' parser = libtcod.parser_new() #Use the parser to read data for monsters. monsterStruct = libtcod.parser_new_struct(parser, "monster") libtcod.struct_add_property(monsterStruct, "name", libtcod.TYPE_STRING, True) libtcod.struct_add_property(monsterStruct, "glyph", libtcod.TYPE_CHAR, True) libtcod.struct_add_property(monsterStruct, "col", libtcod.TYPE_COLOR, True) libtcod.struct_add_property(monsterStruct, "dsc", libtcod.TYPE_STRING, True) libtcod.struct_add_property(monsterStruct, "tier", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "hp", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "atk", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "dfn", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "min", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "max", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "xp", libtcod.TYPE_INT, True) libtcod.struct_add_property(monsterStruct, "deathEffect", libtcod.TYPE_STRING, False) libtcod.parser_run(parser, os.path.join('data', 'monster.cfg'), MonsterReader()) if option_debug: print "The current contents of rawMonsterData, outside of the parsing operation, are..." print rawMonsterData.items() #Use the parser to read data for items. itemStruct = libtcod.parser_new_struct(parser, "item") libtcod.struct_add_property(itemStruct, "name", libtcod.TYPE_STRING, True) libtcod.struct_add_property(itemStruct, "kind", libtcod.TYPE_STRING, True) libtcod.struct_add_property(itemStruct, "col", libtcod.TYPE_COLOR, True) libtcod.struct_add_property(itemStruct, "dsc", libtcod.TYPE_STRING, True) libtcod.struct_add_property(itemStruct, "bloat", libtcod.TYPE_INT, False) libtcod.struct_add_property(itemStruct, "rarity", libtcod.TYPE_INT, True) libtcod.struct_add_property(itemStruct, "useEffect", libtcod.TYPE_STRING, False) #libtcod.struct_add_property(itemStruct, "slot", libtcod.TYPE_STRING, False) libtcod.parser_run(parser, os.path.join('data', 'item.cfg'), ItemReader()) if option_debug: print "The current contents of rawItemData, outside of the parsing operation, are..." print rawItemData.items() #Load the name generation data. for file in os.listdir('data/name'): if file.find('.cfg') > 0: libtcod.namegen_parse(os.path.join('data', 'name', file)) rawNameSets = libtcod.namegen_get_sets()
def create_area(): libtcod.namegen_parse('language_data.txt') area_type = random.choice(["crypt", "castle"]) area_name = libtcod.namegen_generate(area_type) area = Area(name=area_name, area_type=area_type, description="", levels=random.randint(5, 10), tags=[]) area_tags = [] if area_type == "crypt": area_tags = random.choice(["dark", "cursed"]) elif area_type == "castle": area_tags = random.choice(["dark", "cursed"]) area.tags = area_tags return area
def setcorps(): global corpone, corponeproducts, corponehistory, corptwo, corptwoproducts, corptwohistory, corpthree, corpthreeproducts, corpthreehistory libtcod.namegen_parse('corpgen.txt') corpone = libtcod.namegen_generate('corpnames') corponeproducts = libtcod.namegen_generate('corpproducts') corponehistyear = random.randrange(2014, 2019, 1) corponehistory = "in the year " + str(corponehistyear) + " " + corpone + " " + str(libtcod.namegen_generate('corpactions'))\ + " " + str(libtcod.namegen_generate('corpnames')) + " causing " + corpone + " to gain a monopoly on " + corponeproducts corptwo = libtcod.namegen_generate('corpnames') corptwoproducts = libtcod.namegen_generate('corpproducts') corptwohistyear = random.randrange(2014, 2019, 1) corptwohistory = "in the year " + str(corptwohistyear) + " " + corptwo + " " + str(libtcod.namegen_generate('corpactions')) \ + " " + str(libtcod.namegen_generate('corpnames')) + " causing " + corptwo + " to gain a monopoly on " + corptwoproducts corpthree = libtcod.namegen_generate('corpnames') corpthreeproducts = libtcod.namegen_generate('corpproducts') corpthreehistyear = random.randrange(2014, 2019, 1) corpthreehistory = "in the year " + str(corpthreehistyear) + " " + corpthree + " " + str(libtcod.namegen_generate('corpactions')) \ + " " + str(libtcod.namegen_generate('corpnames')) + " causing " + corpthree + " to gain a monopoly on " + corpthreeproducts
turns = 0 pause = False ##Render Modes## traffic = False temperature = False continent = False pathfinding = False path_to_draw = 1 local = False debug_mode = False libtcod.namegen_parse('data/names.txt') DAYS = [ ['Monday', 1], ['Tuesday', 2], ['Wednesday', 3], ['Thursday', 4], ['Friday', 5], ['Saturday', 6], ['Sunday', 7] ] MONTHS = [ ['January', 1, 31], ['February', 2, 28], ['March', 3, 31],
show_panel = False # Farm dimensions farm = Farm(160, 120) farm.viewport.size(SCREEN_WIDTH, SCREEN_HEIGHT) farm.viewport.move(int((farm.width/2)-(SCREEN_WIDTH/2)), 0) entities = [] # More globals, because I love them mouse = libtcod.Mouse() key = libtcod.Key() # Name generator for file in os.listdir(b'data/namegen') : if file.find(b'.cfg') > 0 : libtcod.namegen_parse(os.path.join(b'data',b'namegen',file)) def handle_keys(): global farm, key, mouse, panel_console, show_panel, entities if key.vk != libtcod.KEY_NONE: viewport_dx = 0 viewport_dy = 0 # vertical movement for case in switch(key.vk): if case(libtcod.KEY_UP): pass if case(libtcod.KEY_KP8): pass if case(libtcod.KEY_HOME): pass if case(libtcod.KEY_KP7): pass if case(libtcod.KEY_PAGEUP): pass
import os.path import yaml import textwrap import math import libtcodpy as libtcod import glob libtcod.console_set_keyboard_repeat(500, 50) for fil in glob.glob('./data/namegen/*.cfg'): libtcod.namegen_parse(fil) help = ''' 'i': Inventory 'd': Drop 'g': Get item (Pick up) '?': Help Alt+Escape: Exit Arrow Keys for movement / selecting Name of item under the mouse shown above the health bar ''' from game import GameBase import levels import objects import utilities if __name__ == 'main': class Null: pass class SettingsObject(object): def __init__(self, setting_name, default=Null): self.setting_name = setting_name
def init(): global Player, session_world session_world = World() libtcod.namegen_parse('language_data.txt') #create world for x in xrange(random.randint(10, 20)): area = create_area() session_world.areas.append(area) #create deities for i in range(5): domains = [ "light", "dark", "fire", "ice", "earth", "air", "war", "peace" ] deity_name = libtcod.namegen_generate("deity_names") symbols = libtcod.namegen_generate("symbols") colours = libtcod.namegen_generate("colours") deity = Deity(name=deity_name, domain=random.choice(domains), symbol=symbols, colour=colours) session_world.deities.append(deity) print deity.name #init player Player = Character(name="Player", hp=10, strength=5, dexterity=5, intelligence=5, charisma=5, tags=[]) dagger = Item(name='Dagger', item_type="weapon", tags=[], damage=1, armour=0) axe = Item(name='Axe', item_type="weapon", tags=[], damage=12, armour=0, dex_mod=-2) torch = Item(name='Torch', item_type="utility", tags=["light"], damage=0, armour=0) clothes = Item(name='Clothing', item_type="armour", tags=["light"], damage=0, armour=1) Player.inventory.append(dagger) Player.inventory.append(axe) Player.inventory.append(torch) Player.inventory.append(clothes) #read general encounters with open('encounters.json') as enc_json: encs = json.load(enc_json) for enc in encs["encounters"]: encounter = Encounter(name=enc["name"], description=enc["description"], tags=enc["tags"], item_tags=enc["item_tags"], options=enc["options"]) options = encounter.options encounter.options = [] for opt in options: option = Option(description=opt["description"], tags=opt["tags"], check=opt["check"], check_num=opt["check_num"], reward=opt["reward"], failure=opt["failure"]) encounter.options.append(option) session_world.encounters[encounter.name] = encounter #deitys for deity in session_world.deities: pray_option = Option( "Pray to {}".format(deity.name), tags=[], check="intelligence", check_num=1, reward={ "blessing": "You receive a blessing from {}".format(deity.name) }, failure={"curse": "{} curses you!".format(deity.name)}) leave_option = Option("Leave", tags=[], check="none", check_num=1, reward={"nothing": "You continue onwards."}, failure={"nothing": "You continue onwards."}) shrine_modifier = libtcod.namegen_generate("general_modifiers") shr_start = [ "You come across a {} shrine to {}, ", "Ahead you see a {} shrine dedicated to {}, " ] shr_end = [ "it is covered with {} {}s", "it is adorned with a {} {}", "littered with icons of {} {}s", "in the center is a statue of a {} {}" ] shrine_phrase = random.choice(shr_start) + random.choice(shr_end) encounter = Encounter(name="shrine of {}".format(deity.name), description=shrine_phrase.format( shrine_modifier, deity.name, deity.colour, deity.symbol), tags=[deity.domain], item_tags={ "item": "none", "desc": "", "reward": "nothing" }, options=[pray_option, leave_option]) session_world.encounters[encounter.name] = encounter #monsters with open('monsters.json') as enc_json: mons = json.load(enc_json) for mon in mons: monster = Character(name=mon["name"], hp=mon["hp"], strength=mon["strength"], dexterity=mon["dexterity"], intelligence=mon["intelligence"], charisma=mon["charisma"], armour=mon["armour"], damage=mon["damage"], tags=mon["tags"], level=mon["level"]) session_world.monsters.append(monster) #add items with open('items.json') as enc_json: items = json.load(enc_json) for ite in items["items"]: item = Item(name=ite["name"], item_type=ite["item_type"], tags=ite["tags"], damage=ite["dmg"], armour=ite["armour"], depth=ite["depth"]) #add modifier search so JSON isn't so redic if "crit_chance" in ite: item.crit_chance = ite["crit_chance"] if "dex_mod" in ite: item.dex_mod = ite["dex_mod"] if "int_mod" in ite: item.int_mod = ite["int_mod"] if "str_mod" in ite: item.str_mod = ite["str_mod"] session_world.items.append(item) #start first area session_world.current_area = Area( name="Crumbling Ruins", area_type="cave", description="A cave network filled with crumbling ruins", levels=5, tags=[], depth=1) session_world.current_area.fill_encounter_list() total_levels = 0 #create world and populate for x in xrange(random.randint(7, 10)): area = create_area() AREA_LIST.append(area) num_of_areas = len(AREA_LIST) depth_num = 2 for area in AREA_LIST: area.depth = depth_num depth_num += 1 print area.name + str(area.depth) for area in AREA_LIST: total_levels += area.levels #search list for reasonable start: for enc in session_world.current_area.encounter_list: if enc.name != 'combat': session_world.current_encounter = enc
def test_namegen_parse(): libtcodpy.namegen_parse('../data/namegen/jice_celtic.cfg') assert libtcodpy.namegen_generate('Celtic female') assert libtcodpy.namegen_get_sets() libtcodpy.namegen_destroy()
def game_initialize(): global SURFACE_MAIN, GAME, CLOCK, FOV_CALCULATE, PLAYER, ENEMY, ASSETS #initalizes the main window in pygame pygame.init() pygame.key.set_repeat(200, 70) #set key repeat #SURFACE_MAIN = pygame.display.set_mode((constants.GAME_WIDTH,constants.GAME_HEIGHT)) SURFACE_MAIN = pygame.display.set_mode( (constants.MAP_WIDTH * constants.CELL_WIDTH, constants.MAP_HEIGHT * constants.CELL_HEIGHT)) GAME = obj_Game() CLOCK = pygame.time.Clock() pygame.display.set_caption('Test Game!') FOV_CALCULATE = True ASSETS = struc_Assets() #Name Gen via dorian lib libtcod.namegen_parse("data\\namegen\\jice_celtic.cfg") # container_com1 = com_Container() # creature_com1 = com_Creature("Hero Greg", base_atk = 4) # PLAYER = obj_Actor(1, 1, "python", ASSETS.A_PLAYER , # animation_speed = 1.0, # creature = creature_com1, # container = container_com1) # item_com2 = com_Item(value = 5, use_function = cast_heal) # ai_com2 = ai_Chase() # creature_com3 = com_Creature("bob", death_function = death_monster) # ENEMY2 = obj_Actor(14, 15, "dumb crab", ASSETS.A_ENEMY, animation_speed = 1.0, # creature = creature_com3, ai = ai_com2, item = item_com2) #create a sword #equipment_com1 = com_Equipment(attack_bonus = 2, slot = "hand_right") #SWORD = obj_Actor(2, 2, "Short Sword", ASSETS.S_SWORD, # equipment = equipment_com1) #create a shield #equipment_com2 = com_Equipment(defense_bonus = 2, slot = "hand_left") #SHIELD = obj_Actor(2, 3, "Shield", ASSETS.SHIELD, # equipment = equipment_com2) GAME.current_objects = [] #create scrolls #SCROLL_1 = gen_lightning_scroll((2, 2)) #SCROLL_2 = gen_fireball_scroll((2, 3)) #SCROLL_3 = gen_confusion_scroll((2, 4)) #items gen_item((2, 2)) gen_item((2, 3)) gen_item((2, 4)) #enemies gen_enemy((15, 15)) gen_enemy((15, 16)) PLAYER = gen_player((1, 1)) GAME.current_objects.append(PLAYER)
def setcorps(): global corpone, corponeproducts, corponehistory, corptwo, corptwoproducts, corptwohistory, corpthree, corpthreeproducts, corpthreehistory, corpchosen, corpchosenproducts libtcod.namegen_parse('corpgen.txt'), #historychoice = [ # ' In %(histyear1), %histcorp1 and + histcorp2 + "agreed to a mutual merger of equals, ending their long-running rivalry in pursuit of a common goal. The new entity," +corpchosen+ ", would start off with a complete monopoly over" +corpchosenproducts+' # #, # #'In %histyear2+ "," +histcorp2+ "declared bankruptcy. Their assets were forcibly seized by a shadowy cabal of investors known informally as" +corpchosen+". "+corpchosen+ "would later use those assets to engineer the destruction of several other minor competitors to secure a monopoly over" +corpchosenproducts+' # #, # #'"In" +histyear3+"," +corpchosen+ "("+country1+ "special operations division), refused to follow orders from their mother country and instead went rogue." +corpchosen+ "would later use their military assets to engineer the takeover of several other minor companies to secure a monopoly over" +corpchosenproducts+' # # #'In +year+, wealthy philanthropists formed a 'nonprofit corporation called +corpchosen+, dedicated towards +nonprofitaction+ +corpproducts+.' # #, # #'In +year+, +corpchosen+ (+country+ government agency) was formally privatized to help raise money for the mother country. +corpchosen+ specialized in +corpproducts+.' # #, # #'In +year+, the religious organization +corpchosen+ was established, dedicated towards +nonprofitaction+ +religiousactivity+. To secure funding for its nonprofit activities, +corpchosen+ opened up a business front that specialized in +corpproducts+.' # #, # #'In +year+, +corpname+ successfully infiltrated +corpname+, ending the long-running rivalry between the two companies. The newly merged entity, +corpchosen+, would start off with a complete monopoly over +corpproducts+.' # #, # #'In +year+, vulture capitalists established +corpchosen+ to fund innovative +corpproducts+ start-ups so as to later take them over and seize their considerable profits.' # #, # #'In +year+, the +ideology+ terrorist organization +corpchosen+ went legit in return for legal immunity for their crimes. +corpchosen+ abandoned their political activism to instead focus on maintaining their massive +corpproducts holdings.' # #, # #'In +year+, the criminal organization +corpchosen+ went legit in return for legal immunity for their crimes. +corpchosen+ abandoned their criminal activities to instead focus on maintaining their massive +corpproducts+ holdings.' # #, # #'In +year+, +moderateideology+ activists established a nonprofit corporation known as +corpchosen+ to help coordinate their political campaigns. To secure funding for its nonprofit activities, +corpchosen+ opened up a business front that specialized in +corpproducts+.' # #, # #'In +year+, a rich entrepreneur formed +corpchosen+, a +corpproducts+ startup, after being inspired by dreams about +religiousactivity+.' # #, # #'In +year+, +name+, +country+ preacher, declared himself the reincarnation of Jesus Christ and established a popular megachurch, today known as +corpchosen+, dedicated towards +nonprofitaction+ +religiousactivity+. To secure funding for its nonprofit activities, +corpchosen+ opened up a business front that specialized in +corpproducts+.' # #, # #'In +year+, +name+, +country+ general, established a private military corporation known as +corpchosen+. +corpchosen+ would later use their military assets to engineer the takeover of several other minor companies to secure a monopoly over +corpproducts+.' # #, # #'In +year+, +name+ died, leaving behind a charitable trust worth billions of dollars. This trust, known today as +corpchosen+, is dedicated towards +nonprofitaction+ +corpproducts+.' # % dict( ##histcorp1 = libtcod.namegen_generate('corpnames'), ##histcorp2 = libtcod.namegen_generate('corpnames'), ##histcorp3 = libtcod.namegen_generate('corpnames'), #histyear1 = random.randrange str(2014, 2019, 1))] ##histyear2 = random.randrange(2014, 2019, 1), ##histyear3 = random.randrange(2014, 2019, 1), ##country1 = libtcod.namegen_generate('corpcountry'), ##country2 = libtcod.namegen_generate('corpcountry'), ##country3 = libtcod.namegen_generate('corpcountry'))] libtcod.namegen_parse('corpgen.txt') corpone = libtcod.namegen_generate('corpnames') corpchosen = corpone corponeproducts = libtcod.namegen_generate('corpproducts') corpchosenproducts = corponeproducts corponehistyear = random.randrange(2014, 2019, 1) corponehistory = "in the year " + str(corponehistyear) + " " + corpone + " " + str( libtcod.namegen_generate('corpactions')) \ + " " + str( libtcod.namegen_generate('corpnames')) + " causing " + corpone + " to gain a monopoly on " + corponeproducts corptwo = libtcod.namegen_generate('corpnames') corpchosen = corptwo corptwoproducts = libtcod.namegen_generate('corpproducts') corpchosenproducts = corptwoproducts corptwohistyear = random.randrange(2014, 2019, 1) corptwohistory = "in the year " + str(corptwohistyear) + " " + corptwo + " " + str( libtcod.namegen_generate('corpactions')) \ + " " + str( libtcod.namegen_generate('corpnames')) + " causing " + corptwo + " to gain a monopoly on " + corptwoproducts corpthree = libtcod.namegen_generate('corpnames') corpchosen = corpthree corpthreeproducts = libtcod.namegen_generate('corpproducts') corpchosenproducts = corpthreeproducts corpthreehistyear = random.randrange(2014, 2019, 1) corpthreehistory = "in the year " + str(corpthreehistyear) + " " + corpthree + " " + str( libtcod.namegen_generate('corpactions')) \ + " " + str( libtcod.namegen_generate('corpnames')) + " causing " + corpthree + " to gain a monopoly on " + corpthreeproducts