Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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()