예제 #1
0
def characterize(first='Jane',
                 last='Doe',
                 gender='Female',
                 filename='character.txt',
                 archetype=arch.standard):
    """Generate a fictional character based on user arguments.

    Parameters
    ----------
    first : str
        The first name of the character.
    last : str
        The last name of the character.
    gender : str
        The gender of the character.
    filename : str
        Path of the text file to export character info.
    archetype : archetype
        Type of archetype (standard or antagonist).

    Returns
    -------
    .txt
        Outputs a character.txt file with the character info.

    """

    f = open(filename, 'w')
    my_char = Character(first, last, gender, archetype)  # Create a character.
    my_char.sample_traits(archetype)  # Sample some personality traits.
    f.write(my_char.export_markdown())  # Serialize character sheet Markdown.
    f.close()
예제 #2
0
def characterize(first='Jane',
                 last='Doe',
                 gender='Female',
                 archetype=arch.standard):
    '''Generate a fictional character based on user arguments.'''

    my_char = Character(first, last, gender, archetype)  # Create a character.
    my_char.sample_traits(archetype)  # Sample some personality traits.
    my_char.export_markdown()  # Serialize character sheet in Markdown.
예제 #3
0
def parse_characters(movie_map):
    for line in open("cornell-movie-dialogs-corpus/movie_characters_metadata.txt"):
        cats = line.split(" +++$+++ ")
        character_id = cats[0].strip().lower()
        name = cats[1].strip().lower()
        m_id = cats[2].strip().lower()
        gender = cats[4].strip().lower()
        position = -1 if cats[5].strip() == '?' else int(cats[5].strip())
        char = Character(character_id, name, gender, position)
        movie_map[m_id].add_character(char)
예제 #4
0
 def startup_end(self):
     name = self.charactername['Character Name?']
     path = (iface.JSONInterface.OBJECTSPATH
             + 'character/' + name + '.character')
     if (os.path.exists(path)):
         jf = iface.JSONInterface('character/' + name + '.character')
     else:
         raise FileNotFoundError
     character = Character(jf)
     self.block = AbilityDisplay(self.f, character)
     self.draw_static()
     self.container.deiconify()
예제 #5
0
def test_char_levelmixin():
    """ Test for level-up functionality """
    char = Character('John Doe', max_level=5)

    assert 1 == char.level
    assert 85 == char.next_level
    assert char.give_exp(
        85
    ) == f"Congratulations! You've levelled up; your new level is {char.level}\nEXP required for next level: {int(char.next_level-char.experience)}\nCurrent EXP: {char.experience}"
    for _ in range(char.max_level - char.level):
        char.give_exp(char.next_level)
    assert char.level == char.max_level
    assert char.give_exp(char.next_level) == f""
예제 #6
0
def launch_party():
    """ Launching background, maze and mac gyver"""

    background = pygame.image.load(background_pict).convert()
    resized_background = pygame.transform.scale(background,
                                                (window_size, window_size))

    maze = Maze("maze.txt")
    maze.generate_maze()

    mc_gyver = Character(mcgyver_pict, maze)

    return resized_background, maze, mc_gyver
예제 #7
0
async def pc_create(state, context, name):
    user = str(context.author)
    if user not in state.users:
        if await state.check_no_confusion(context, name):
            state.users[user] = Character(name=name)
            state.users[user].permissions = [user]
            state.save()
            state.update_commands()
            await state.log(
                context, f"Created a character for {user} with name {name}.")
    else:
        await context.channel.send(
            f"You already have a character called {state.users[user].name}.")
예제 #8
0
    async def create_character(
            self,
            ctx,
            char_name=None,
            class_type=None,
            level: int = 1,
            background=None,
            alignment=None,
            race=None,
            exp: int = 0,
            proficiencies=None,
            attributes=None
    ):
        if isinstance(class_type, Class):
            class_type = class_type
        elif class_type in class_list:
            class_type = class_list[class_type]
        else:
            class_type = None
        if proficiencies is not None:
            proficiencies = dict(proficiencies.split(','))
        if attributes is None or len(attributes.split(',')) != 6:
            attributes = Attributes()
        else:
            att = attributes.split(',')
            if len(att) == 6:
                attributes = Attributes(
                    int(att[0]), int(att[1]), int(att[2]), int(att[3]), int(att[4]), int(att[5])
                )
            else:
                attributes = Attributes()

        current = Character(
            user_id=ctx.author.id,
            char_name=char_name,
            class_type=class_type,
            level=level,
            background=background,
            alignment=alignment,
            race=race,
            exp=exp,
            proficiencies=proficiencies,
            attributes=attributes
        )
        self.bot.character_list.update({ctx.author.id: current})
        await ctx.send('Created a character object for your UserID!', delete_after=10)
예제 #9
0
파일: main.py 프로젝트: NhanTrungHa/TextRPG
def main():
    statDict = {'str': 0, 'int': 0, 'dex': 0}

    print('''
        You awaken and are instantly enveloped by light.
        As you feel the warmth of something wrapping around you, 
        you hear voices speaking in a language you don't yet understand.

        It seems as if you have been reborn in another world.
        What do you desire to be called? 
        ''')

    name = input()
    player = Character(name)

    print('\n' + name + '!'
          '''
        You hear your father call out to you from the yard.
        It's been 6 years and you've learnt the basics of this new world.
        The land is called Memoria and you've been born into a peasant class family. 
        Your father is a retired adventurer while your mother was married to him from a young age.
        His voice calls out to you again to come out for your daily training. 
        What shall you do?
                1. Train
                2. Ignore Him
        ''')

    choice = input()

    if choice == "1" or "train".casefold():
        statDict = {'str': 1, 'int': 0, 'dex': 0}
        player.modStats(statDict)
        "You decide to come out and train for a few hours. (+1 to strength.)"
    elif choice == "2" or "ignore".casefold() or "ignore him".casefold():
        '''You ignore your father and continue to laze around. 
                Instead, you opt to stay inside and read the latest edition of "The Daily Wizard"
                (+1 to intellegence.)
                '''

    print('''
        The day
        ''')
예제 #10
0
 if reverse:  # Проверка на поворот гг
     player.image = pygame.transform.flip(player.image, 1, 0)
     reverse = False
 if not startsc and not cutscene:  # Апдейт положения всех спрайтов на экране
     camera.update(player)
     for sprite in all_sprites:
         camera.apply(sprite)
     screen.fill((0, 0, 0))
     all_sprites.draw(screen)
 if cutscene and checkpoint == '1':  # Первая катсцена
     if cutloading:
         player.rect.x = 500
         player.rect.y = 1400
         brothimage = load_image('characters2', 'broth', 'png')
         dimi = load_image('characters2', 'dim', 'png')
         dim = Character(dimi, wall_group, all_sprites)
         broth = Character(brothimage, wall_group, all_sprites)
         broth.rect.y = 1300
         broth.rect.x = 500
         peri = load_image('characters2', 'per', 'png')
         seci = load_image('characters2', 'sec', 'png')
         thiri = load_image('characters2', 'thir', 'png')
         per = Character(peri, wall_group, all_sprites)
         sec = Character(seci, wall_group, all_sprites)
         thir = Character(thiri, wall_group, all_sprites)
         magi = load_image('characters2', 'mag', 'png')
         mag = Character(magi, wall_group, all_sprites)
         for i in range(11):
             brothrun.append(
                 load_image('characters2',
                            'runbroth\Running_0' + str(i + 1), 'png'))
예제 #11
0
os.system('cls' if os.name == 'nt' else 'clear')
from pygame import mixer
mixer.init()


# Music
def sound(file):
    sound = mixer.Sound(f"audio/{file}")
    return mixer.Sound.play(sound)


# this is our main program

# Character Instantiation
crystal = Character(
    'Crystal', 40, "she", "her",
    "Crystal starts with alert level of 40. Resourceful. Power: She can move to any room without the elevator."
)
jojo = Character(
    'JoJo', 10, "she", "her",
    "JoJo starts with alert level of 10. Sneaky. Power: She can carry 1 extra item."
)
kurtis = Character(
    'Kurtis', 30, "he", "his",
    "Kurtis starts with alert level of 30. Detail oriented. Power: After 80, his alert level penalty is decreased by half points."
)
joshua = Character(
    'Joshua', 5, "he", "his",
    "Joshua starts with alert level of 5. Obsessive compulsive. Power: Doesn't leave a mess"
)
annalise = Character('Annalise Keating', 0, "she", "her", "No mistakes!")
main_players = [crystal, jojo, kurtis, joshua]
예제 #12
0
def read_data(movies, characters, females, males, unknowns):

    inMovies = open('%s/1_titles_clean.txt' % (CORNELL_SRCFOL), mode='r',
        encoding='ISO-8859-1')
    inChars = open('%s/3_characters_gendered_genderize.txt' % (CORNELL_SRCFOL),
        mode='r', encoding='ISO-8859-1')
    inLines = open('%s/1_lines_clean.txt' % (CORNELL_SRCFOL), mode='r',
        encoding='ISO-8859-1')

    # Stores movie metadata
    for line in inMovies:
        fields = line.replace('\n', '').rsplit('\t')

        id = int(fields[0][1:])
        title = fields[1]
        year = int(fields[2])
        rating = float(fields[3])
        votes = int(fields[4])
        genres = None if len(fields) < 6 else fields[5].rsplit(', ')

        movie = Movie(id, title, year, rating, votes, genres)
        movies.append(movie)

    # Stores character metadata
    for line in inChars:
        fields = line.replace('\n', '').rsplit('\t')

        id = int(fields[0][1:])
        name = fields[1]
        movieID = int(fields[2][1:])
        movie = movies[movieID]
        gender = fields[4]
        pos = int(fields[5])

        character = Character(id, name, movie, gender, pos)
        movie.add_character(character)
        characters.append(character)

        # Adds character to Characters object corresponding to gender
        if (character.gender() == 'f'):
            females.append(character)
        elif (character.gender() == 'm'):
            males.append(character)
        else:
            unknowns.append(character)

    # Stores lines with corresponding character
    for line in inLines:
        fields = line.replace('\n', '').rsplit('\t')

        # Continue if no line is spoken
        if (len(fields) < 5):
            continue

        id = int(fields[0][1:])
        charID = int(fields[1][1:])
        movieID = int(fields[2][1:])
        text = fields[4]

        characters[charID].add_line(text)

    inMovies.close()
    inChars.close()
    inLines.close()
예제 #13
0
    parser.add_argument("-d", "--db_url", required=True, help="MySQL host")
    args = parser.parse_args()

    characters = {}
    while len(characters) != 15:
        # Ensuring always unique character
        while True:
            char_id = rand_id()
            if char_id not in characters:
                break

        # Seems 17 is currently broken -- skipping it
        if char_id == 17:
            continue

        char = Character(char_id)
        char.get_cross_ref("films")
        char.prep_for_db()
        characters[char_id] = char

    try:
        # Set up DB connection, table, and load data
        engine = db.db_connect(args.user, args.password, args.db_url)
        char_table = db.create_char_table(engine)
        for char in characters:
            db.insert_character(engine, char_table, characters[char])

        # Pull names and films from DB
        characters = engine.execute(
            "SELECT name, films from characters").fetchall()
        print(len(characters))
예제 #14
0
 def setUp(self):
     from classes import Rectangle, Character
     self.rect = Rectangle(2, 2, 2, 2)
     self.charr = Character(1, 1, 'A', 'black', False)
예제 #15
0
 Character(
     user_id=228716653318373376,
     char_name="Vol",
     class_type=Class(
         name="fighter",
         desc=
         "### Fighting Style \n \nYou adopt a particular style of fighting as your specialty. Choose one of the "
         "following options. You can't take a Fighting Style option more than once, even if you later get to choose "
         "again. \n \n "
         "#### Archery \n \n"
         "You gain a +2 bonus to attack rolls you make with ranged weapons. \n \n"
         "#### Defense \n \n"
         "While you are wearing armor, you gain a +1 bonus to AC. \n \n"
         "#### Dueling \n \n"
         "When you are wielding a melee weapon in one hand and no other weapons, you gain a +2 bonus to damage rolls with "
         "that weapon. \n \n "
         "#### Great Weapon Fighting \n \n"
         "When you roll a 1 or 2 on a damage die for an attack you make with a melee weapon that you are wielding with two "
         "hands, you can reroll the die and must use the new roll, even if the new roll is a 1 or a 2. The weapon must "
         "have the two-handed or versatile property for you to gain this benefit. \n \n "
         "#### Protection \n \n"
         "When a creature you can see attacks a target other than you that is within 5 feet of you, you can use your "
         "reaction to impose disadvantage on the attack roll. You must be wielding a shield. \n \n "
         "#### Two-Weapon Fighting \n \n"
         "When you engage in two-weapon fighting, you can add your ability modifier to the damage of the second attack. \n "
         "\n "
         "### Second Wind \n \n"
         "You have a limited well of stamina that you can draw on to protect yourself from harm. On your turn, you can use "
         "a bonus action to regain hit points equal to 1d10 + your fighter level. Once you use this feature, "
         "you must finish a short or long rest before you can use it again. \n \n "
         "### Action Surge \n \n"
         "Starting at 2nd level, you can push yourself beyond your normal limits for a moment. On your turn, you can take "
         "one additional action on top of your regular action and a possible bonus action. \n \n "
         "Once you use this feature, you must finish a short or long rest before you can use it again. Starting at 17th "
         "level, you can use it twice before a rest, but only once on the same turn. \n \n "
         "### Martial Archetype \n \n"
         "At 3rd level, you choose an archetype that you strive to emulate in your combat styles and techniques. Choose "
         "Champion, Battle Master, or Eldritch Knight, all detailed at the end of the class description. The archetype you "
         "choose grants you features at 3rd level and again at 7th, 10th, 15th, and 18th level. \n \n "
         "### Ability Score Improvement \n \n"
         "When you reach 4th level, and again at 6th, 8th, 12th, 14th, 16th, and 19th level, you can increase one ability "
         "score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, "
         "you can't increase an ability score above 20 using this feature. \n \n "
         "### Extra Attack \n \n"
         "Beginning at 5th level, you can attack twice, instead of once, whenever you take the Attack action on your turn. "
         "\n \n "
         "The number of attacks increases to three when you reach 11th level in this class and to four when you reach 20th "
         "level in this class. \n \n "
         "### Indomitable \n \n"
         "Beginning at 9th level, you can reroll a saving throw that you fail. If you do so, you must use the new roll, "
         "and you can't use this feature again until you finish a long rest. \n \n "
         "You can use this feature twice between long rests starting at 13th level and three times between long rests "
         "starting at 17th level.\n \n "
         "### Martial Archetypes \n \n"
         "Different fighters choose different approaches to perfecting their fighting prowess. The martial archetype you "
         "choose to emulate reflects your approach.",
         hit_dice="1d10",
         prof_armor="All armor, shields",
         prof_weapons="Simple weapons, martial weapons",
         prof_tools="None",
         prof_saving_throws="Strength, Constitution",
         prof_skills=
         "Choose two skills from Acrobatics, Animal, Handling, Athletics, History, Insight, Intimidation, "
         "Perception, and Survival",
         equipment=
         "You start with the following equipment, in addition to the equipment granted by your background: \n \n"
         "* (*a*) chain mail or (*b*) leather armor, longbow, and 20 arrows \n"
         "* (*a*) a martial weapon and a shield or (*b*) two martial weapons \n"
         "* (*a*) a light crossbow and 20 bolts or (*b*) two handaxes \n"
         "* (*a*) a dungeoneer's pack or (*b*) an explorer's pack",
         table=
         "| Level | Proficiency Bonus | Features                                          | \n"
         "|-------|-------------------|---------------------------------------------------| \n"
         "| 1st   | +2                | Fighting Style, Second Wind                       | \n"
         "| 2nd   | +2                | Action Surge (one use)                            | \n"
         "| 3rd   | +2                | Martial Archetype                                 | \n"
         "| 4th   | +2                | Ability Score Improvement                         | \n"
         "| 5th   | +3                | Extra Attack                                      | \n"
         "| 6th   | +3                | Ability Score Improvement                         | \n"
         "| 7th   | +3                | Martial Archetype Feature                         | \n"
         "| 8th   | +3                | Ability Score Improvement                         | \n"
         "| 9th   | +4                | Indomitable (one use)                             | \n"
         "| 10th  | +4                | Martial Archetype Feature                         | \n"
         "| 11th  | +4                | Extra Attack (2)                                  | \n"
         "| 12th  | +4                | Ability Score Improvement                         | \n"
         "| 13th  | +5                | Indomitable (two uses)                            | \n"
         "| 14th  | +5                | Ability Score Improvement                         | \n"
         "| 15th  | +5                | Martial Archetype Feature                         | \n"
         "| 16th  | +5                | Ability Score Improvement                         | \n"
         "| 17th  | +6                | Action Surge (two uses), Indomitable (three uses) | \n"
         "| 18th  | +6                | Martial Archetype Feature                         | \n"
         "| 19th  | +6                | Ability Score Improvement                         | \n"
         "| 20th  | +6                | Extra Attack (3)                                  | ",
         spellcasting_ability="",
         subtypes_name="Martial Archetypes",
         archetypes={
             "champion": {
                 "name":
                 "Champion",
                 "slug":
                 "champion",
                 "desc":
                 "The archetypal Champion focuses on the development of raw physical power honed to deadly "
                 "perfection. Those who model themselves on this archetype combine rigorous training with physical "
                 "excellence to deal devastating blows. \n \n "
                 "##### Improved Critical \n \n"
                 "Beginning when you choose this archetype at 3rd level, your weapon attacks score a critical hit "
                 "on a roll of 19 or 20. \n \n "
                 "##### Remarkable Athlete \n \n"
                 "Starting at 7th level, you can add half your proficiency bonus (round up) to any Strength, "
                 "Dexterity, or Constitution check you make that doesn't already use your proficiency bonus. \n \n "
                 "In addition, when you make a running long jump, the distance you can cover increases by a number "
                 "of feet equal to your Strength modifier. \n \n "
                 "##### Additional Fighting Style \n \n"
                 "At 10th level, you can choose a second option from the Fighting Style class feature. \n \n"
                 "##### Superior Critical \n \n"
                 "Starting at 15th level, your weapon attacks score a critical hit on a roll of 18-20. \n \n"
                 "##### Survivor \n \n"
                 "At 18th level, you attain the pinnacle of resilience in battle. At the start of each of your "
                 "turns, you regain hit points equal to 5 + your Constitution modifier if you have no more than "
                 "half of your hit points left. You don't gain this benefit if you have 0 hit points."
             }
         }),
     level=1,
     background="soldier",
     alignment="chaotic good",
     race="human",
     exp=0,
     proficiencies=["athletics", "acrobatics", "animal handling"],
     attributes=Attributes(strength=10,
                           dexterity=12,
                           constitution=14,
                           intelligence=16,
                           wisdom=18,
                           charisma=8))
예제 #16
0
import time
import sys
from pygame import mixer
from classes import Character
from text import victory, ending_story, fatality


mixer.init()


# Character Functions and Definitions

character1 = Character("K. Relly", 50, "high", "high",
                       30, "Acid Drool", "low", "M")
character2 = Character("Charg'n Ryno", 50, "medium", "low",
                       30, "Gor'n Horn Of Pain", "medium", "M")
character3 = Character("NeckBreakin Brit", 50, "low",
                       "high", 30, "Roundhouse Kick To The Face", "high", "F")
character4 = Character("Snake Jodgel", 50, "high",
                       "medium", 30, "Eye Gouge", "low", "M")
character5 = Character("Ron Sheid", 50, "low", "low",
                       30, "Bitch Slap", "high", "M")
character6 = Character("Justin", 50, "high", "low", 30,
                       "Words Of Fury", "medium", "M")
character7 = Character("Cave Dolòn", 50, "high", "low",
                       30, "Nutcracker Choke", "high", "M")
character8 = Character("Crazyeyes Chris", 50, "high",
                       "medium", 30, "Stare Of Death", "medium", "M")
character9 = Character("Yelrac Zil", 50, "high", "high",
                       30, "Teleport & Attack From Behind", "high", "F")
예제 #17
0
파일: game.py 프로젝트: dstonem/max_run
    largeText = pygame.font.Font('freesansbold.ttf', 28)
    TextSurf, TextRect = text_objects(text, largeText)
    TextRect.center = ((100), (posY))
    win.blit(TextSurf, TextRect)


################################
### CHARACTERS
################################

max_img = pygame.image.load(
    "/Users/dylan/dc_projects/max_run/resources/max.png")
max_img = pygame.transform.scale(max_img, (100, 125))
max_img = pygame.transform.flip(max_img, 0, 180)
max = Character("Max", {
    "x": width / 2,
    "y": height / 2
}, (game.level * 50) / 2)

# list containinig every bully he hugged
new_friends = []
friend = Enemy("badguy", {
    "x": random.randint(1, width - 100),
    "y": random.randint(0, height)
}, True, 0)

enemies = []
badguy_running = []
counter_ones = 0
counter_tens = 0
# append the images to enable the running visual effect
for i in range(1, 43):