コード例 #1
0
ファイル: grimnovebattle.py プロジェクト: jajaio/kingsarmy
def fight():
    global q, player, monster
    load.load_game()
    player=cl.Player()
    monster=cl.Grimnove()
    while True:
        if player.hp < 1:                                                                                                                                                                            
            print(c.yellow+"You Died!")                                                                                                                                                                       
            t.sleep(1)                                                                                                                                                                               
            ter=input("Do you want to keep playing, or quit? (1), (2)"+c.reset+" >>>"+c.violet).strip()                                                                                          
            if ter == '1':                                                                                                                                                                           
                skull.woods()                                                                                                                                                                               
            elif ter == '2':                                                                                                                                                                         
                exit()                                                                                                                                                                               
            else:                                                                                                                                                                                    
                skull.woods()                                                                                                                                                                               
        elif monster.hp < 1:                                                                                                                                                                         
            finish()
        else:
            print(c.clear)
            print(c.blue+player.name+str(" HP = ")+str(player.hp)+str(": ")+player.name+str(" MP = ")+str(player.mp))
            print(c.red+monster.mname+str(" HP = "+str(monster.hp)+str(": ")+monster.mname+str(" MP = ")+str(monster.mp)))
            q=input(c.reset+"Attack(1) or Heal(2)? >>>"+c.violet).strip().lower()
            if player.agi >= monster.agi:
                pmove()
                scanner()
                ai()
            elif monster.agi > player.agi:
                ai()
                scanner()
                pmove()
コード例 #2
0
def fight():
    global q, player, monster
    load.load_game()
    player = cl.Player()
    monster = cl.Dragon()
    while True:
        if player.hp < 1:
            print(c.yellow + "You Died!")
            t.sleep(1)
            ter = input("Do you want to keep playing, or quit? (1), (2)" +
                        c.reset + " >>>" + c.violet).strip()
            if ter == '1':
                break
            elif ter == '2':
                exit()
            else:
                break
        elif monster.hp < 1:
            print(c.yellow + "You won!")
            cl.Player.gold += 100000
            save.save_game()
            t.sleep(1)
            print("Blinding light begins too engulf you.")
            t.sleep(1.25)
            print(c.clear)
            print(".")
            t.sleep(1)
            print(c.clear)
            print("..")
            t.sleep(1)
            print(c.clear)
            print("...")
            t.sleep(1)
            print(c.clear)
            print("You awaken.")
            t.sleep(1.5)
            print(c.clear)
            credits.roll()
            exit()
        else:
            print(c.clear)
            print(c.blue + player.name + str(" HP = ") + str(player.hp) +
                  str(": ") + player.name + str(" MP = ") + str(player.mp))
            print(c.red + monster.mname +
                  str(" HP = " + str(monster.hp) + str(": ") + monster.mname +
                      str(" MP = ") + str(monster.mp)))
            q = input(c.reset + "Attack(1) or Heal(2)? >>>" +
                      c.violet).strip().lower()
            if player.agi >= monster.agi:
                pmove()
                scanner()
                ai()
            elif monster.agi > player.agi:
                ai()
                scanner()
                pmove()
コード例 #3
0
ファイル: play.py プロジェクト: ethanbaker/train-your-dragon
def main():
    load.load_game()
    print(co.g + 'You play with ' + cl.Dragon.name + '.')
    print(b.playerColorDef())
    s(1.5)
    anim.playAnim()
    cl.Dragon.hap += 45
    cl.Dragon.hap += cl.Dragon.lvl * 2
    cl.Dragon.hap += r.randint(1, 10)
    if cl.Dragon.hap > 100:
        cl.Dragon.hap = 100
    save.save_game()
    c()
コード例 #4
0
ファイル: dragonbattle.py プロジェクト: jajaio/alphaquest
def fight():
    global q, player, monster
    load.load_game()
    player=cl.Player()
    monster=cl.Dragon()
    while True:
        if player.hp < 1: 
            print(c.yellow+"You Died!")                                                                                                                                                                       
            t.sleep(1)                                                                                                                                                                               
            ter=input("Do you want to keep playing, or quit? (1), (2)"+c.reset+" >>>"+c.violet).strip()                                                                                                                              
            if ter == '1':                                                                                                                                                                           
                break                                                                                                                                                                                
            elif ter == '2':                                                                                                                                                                         
                exit()                                                                                                                                                                               
            else:                                                                                                                                                                                    
                break                                                                                                                                                                                
        elif monster.hp < 1:                                                                                                                                                                         
            print(c.yellow+"You won!")                                                                                                                                                               
            cl.Player.gold+=100000
            save.save_game()
            t.sleep(1)                                                                                                                                                                               
            print("Blinding light begins too engulf you.")
            t.sleep(1.25)
            print(c.clear)
            print(".")
            t.sleep(1)
            print(c.clear)
            print("..")
            t.sleep(1)
            print(c.clear)
            print("...")
            t.sleep(1)
            print(c.clear)
            print("You awaken.")
            t.sleep(1.5)
            print(c.clear)
            credits.roll()
            exit()
        else:
            print(c.clear)
            print(c.blue+player.name+str(" HP = ")+str(player.hp)+str(": ")+player.name+str(" MP = ")+str(player.mp))
            print(c.red+monster.mname+str(" HP = "+str(monster.hp)+str(": ")+monster.mname+str(" MP = ")+str(monster.mp)))
            q=input(c.reset+"Attack(1) or Heal(2)? >>>"+c.violet).strip().lower()
            if player.agi >= monster.agi:
                pmove()
                scanner()
                ai()
            elif monster.agi > player.agi:
                ai()
                scanner()
                pmove()
コード例 #5
0
def ask():
    load.load_game()
    tourney = input(
        co.b +
        'What tournament would you like to enter?\nBronze - 1\nSilver - 2\nGold - 3\nCrystal - 4\n >>> '
    )
    if tourney == '1':
        bronzeCup()
    elif tourney == '2':
        silverCup()
    elif tourney == '3':
        goldCup()
    elif tourney == '4':
        crystalCup()
    else:
        print(co.y + 'Please answer with a 1, 2, 3, or 4.')
        s(2)
        c()
        ask()
コード例 #6
0
ファイル: duneengine.py プロジェクト: jajaio/kingsarmy
def fight():
    global q, player, monster
    load.load_game()
    player=cl.Player()
    monster=cl.Foe()
    while True:
        if player.hp < 1:                                                                                                                                                                            
            print(c.yellow+"You Died!")                                                                                                                                                                       
            t.sleep(1)                                                                                                                                                                               
            ter=input("Do you want to keep playing, or quit? (1), (2)"+c.reset+" >>>"+c.violet).strip()                                                                                          
            if ter == '1':                                                                                                                                                                           
                break                                                                                                                                                             
            elif ter == '2':                                                                                                                                                                         
                print('[Exiting game...]')
                exit()                                                                                                                                                                               
            else:                                                                                                                                                                                    
                break                                                                                                                                                                                
        elif monster.hp < 1:                                                                                                                                                                         
            print(c.yellow+"You won!")                                                                                                                                                               
            t.sleep(1)                                                                                                                                                                               
            gain=random.randint(20, 35)                                                                                                                                                               
            print("You got "+str(gain)+" XP!")                                                                                                                                                     
            cl.Player.xp+=int(gain)                                                                                                                                                                
            t.sleep(1)
            save.save_game()                                                                                                                                                                         
            input('[Game Saved! Press enter to continue.]')                                                                                                                                          
            break     
        else:
            print(c.clear)
            print(c.blue+player.name+str(" HP = ")+str(player.hp)+str(": ")+player.name+str(" MP = ")+str(player.mp))
            print(c.red+monster.mname+str(" HP = "+str(monster.hp)+str(": ")+monster.mname+str(" MP = ")+str(monster.mp)))
            q=input(c.reset+"Attack(1) or Heal(2)? >>>"+c.violet).strip().lower()
            if player.agi >= monster.agi:
                pmove()
                scanner()
                ai()
            elif monster.agi > player.agi:
                ai()
                scanner()
                pmove()
コード例 #7
0
ファイル: town.py プロジェクト: jajaio/kingsarmy
def hub():
    load.load_game()
    print(c.clear)
    print(c.yellow+"You arrive on the King's Great Dragon, KillFang.")
    hubquestion=input("Would you like to go back to your tent? The shrine? Or into the open skies? (1), (2), (3)"+c.reset+" >>>"+c.violet)
    if hubquestion=="1":
        print(c.yellow+"You decide to go back to your tent.")
        t.sleep(1.3)
        inn()
    elif hubquestion=="2":
        print(c.yellow+"You decide to go to the shrine.")
        t.sleep(1.3)
        shrine()
    elif hubquestion=="3":
        print(c.yellow+"You hop on "+str(cl.Player.dragon)+" and fly off into the distance.")
        t.sleep(1.3)
        anim.dragonanim()
        sky.select()
    else:
        print("I don't understand...")
        t.sleep(1)
        hub()
コード例 #8
0
ファイル: backupgame.py プロジェクト: cswgames/alphaquest
def neworload():
    qws=input(c.yellow+"Do you want to start a new game? Or load a save file?"+c.reset+" (1), (2)"+c.violet).strip()
    if qws=="1":
        qwa=input(c.yellow+"Are you sure? Any old save file will be deleted."+c.reset+" (Y/N)"+c.violet).strip().lower()
        if qwa=="y":
            nameask()
        elif qwa=="n":
            neworload()
        else:
            neworload()
    elif qws=="2":
        print(c.yellow+"Okay! Here's your stats.")
        load.load_game()
        cl.show_player()
        qwz=input(c.yellow+"Are you sure you want to load this?"+c.reset+" (Y/N)"+c.violet).strip().lower()
        if qwz=="y":
            town.hub()
        if qwz=="n":
            neworload()
    else:
        print(c.yellow+"I don't understand... type 1 for a save file, and 2 for loading a game.")
        neworload()
コード例 #9
0
def ask():
    c()
    load.load_game()
    print(co.g + 'Welcome to the practice center!')
    print()
    level = input(
        co.b +
        'What level would you like to practice with?\nLevel One - 1\nLevel Two - 2\nLevel Three - 3\n >>> '
    )
    if level == '1':
        c()
        lvlOne()
    elif level == '2':
        c()
        lvlTwo()
    elif level == '3':
        c()
        lvlTwo()
    else:
        print('Please answer with a 1, 2, or 3.')
        s(2)
        c()
コード例 #10
0
ファイル: run.py プロジェクト: ethanbaker/train-your-dragon
def askLoad():
    load = input(
        co.b +
        'Would you like to make a new game or load an old save?\nNew - 1\nOld - 2\n >>> '
    ).strip().lower()
    if load == '1':
        cl.Dragon = cl.Base
        c()
        askColor()
        askName()
        saves.save_game()
        saves.save_scores()
        game.welcome()
        game.main()
    elif load == '2':
        loads.load_game()
        loads.load_scores()
        c()
        game.main()
    else:
        print(co.y + "Please respond with a 1 or a 2.")
        s(1.5)
        c()
        askLoad()
コード例 #11
0
ファイル: game.py プロジェクト: TeaTrey/RoguePy
def main():
    constants = get_constants()

    tcod.console_set_custom_font(
        'fonts/libtcod/arial10x10.png',
        tcod.FONT_TYPE_GREYSCALE | tcod.FONT_LAYOUT_TCOD)

    tcod.console_init_root(constants['screen_width'],
                           constants['screen_height'],
                           constants['window_title'], False)

    con = tcod.console_new(constants['screen_width'],
                           constants['screen_height'])
    panel = tcod.console_new(constants['screen_width'],
                             constants['panel_height'])

    player = None
    entities = []
    game_map = None
    message_log = None
    game_state = None

    show_main_menu = True
    show_load_error_message = False

    main_menu_background_image = tcod.image_load('menu_background.png')

    key = tcod.Key()
    mouse = tcod.Mouse()

    while not tcod.console_is_window_closed():
        tcod.sys_check_for_event(tcod.EVENT_KEY_PRESS | tcod.EVENT_MOUSE, key,
                                 mouse)

        if show_main_menu:
            main_menu(con, main_menu_background_image,
                      constants['screen_width'], constants['screen_height'])

            if show_load_error_message:
                message_box(con, 'No save game to load', 50,
                            constants['screen_width'],
                            constants['screen_height'])

            tcod.console_flush()

            action = handle_main_menu(key)

            new_game = action.get('new_game')
            load_saved_game = action.get('load_game')
            exit_game = action.get('exit')

            if show_load_error_message and (new_game or load_saved_game
                                            or exit_game):
                show_load_error_message = False
            elif new_game:
                player, entities, game_map, message_log, game_state = get_game_variables(
                    constants)
                game_state = GameStates.PLAYERS_TURN

                show_main_menu = False
            elif load_saved_game:
                try:
                    player, entities, game_map, message_log, game_state = load_game(
                    )
                    show_main_menu = False
                except FileNotFoundError:
                    show_load_error_message = True
            elif exit_game:
                break

        else:
            tcod.console_clear(con)
            play_game(player, entities, game_map, message_log, game_state, con,
                      panel, constants)

            show_main_menu = True
コード例 #12
0
ファイル: grimnovebattle.py プロジェクト: jajaio/kingsarmy
        if player.hp < 1:                                                                                                                                                                            
            print(c.yellow+"You Died!")                                                                                                                                                                       
            t.sleep(1)                                                                                                                                                                               
            ter=input("Do you want to keep playing, or quit? (1), (2)"+c.reset+" >>>"+c.violet).strip()                                                                                          
            if ter == '1':                                                                                                                                                                           
                skull.woods()                                                                                                                                                                               
            elif ter == '2':                                                                                                                                                                         
                exit()                                                                                                                                                                               
            else:                                                                                                                                                                                    
                skull.woods()                                                                                                                                                                               
        elif monster.hp < 1:                                                                                                                                                                         
            finish()
        else:
            print(c.clear)
            print(c.blue+player.name+str(" HP = ")+str(player.hp)+str(": ")+player.name+str(" MP = ")+str(player.mp))
            print(c.red+monster.mname+str(" HP = "+str(monster.hp)+str(": ")+monster.mname+str(" MP = ")+str(monster.mp)))
            q=input(c.reset+"Attack(1) or Heal(2)? >>>"+c.violet).strip().lower()
            if player.agi >= monster.agi:
                pmove()
                scanner()
                ai()
            elif monster.agi > player.agi:
                ai()
                scanner()
                pmove()

if __name__=='__main__':
    load.load_game()
    cl.Foe=cl.Grimnove
    fight()
コード例 #13
0
def main():
    loa.load_game()
    askTrain()
コード例 #14
0
    output.sort(reverse=True)
    logger.info(
        "\n\nteam_name,dist_miles,player_name\n{}\n\n".format(
            "\n".join(','.join(x) for x in output)
        )
    )


if __name__ == '__main__':

    # Read in command-line arguments
    game_path = sys.argv[1]  # Path to the raw SportVU data

    # Set up a logger
    logger = get_logger("distance-{}".format(game_path))

    # Read in the SportVU data
    game = load_game(game_path, logger)

    # Create a map between player_id and name
    id_to_player = dict(
        [(x.player_id, x) for x in game.home_team.players] +
        [(x.player_id, x) for x in game.away_team.players]
    )

    # Compute distance travelled by each player
    player_distances = compute_player_distances(game, id_to_player, logger)

    # Log player distances to console
    log_distances(player_distances, logger)
コード例 #15
0
#!/usr/bin/env python
"""
The main entry point for the game
"""

from managers.game_manager import GameManager
from load import load_game

if __name__ == '__main__':
    load_game()
    game_manager = GameManager()
    game_manager.show_main_menu()
コード例 #16
0
            c()
    cl.Dragon.htp = 100
    Enemy.htp = 100

def decide():
    if first == 'Enemy':
        player = False
    elif first == 'Player':
        player = True
    decide = False

def pfirst():
    pmove()
    playerSkillCheck()
    emove()

def efirst():
    emove()
    playerSkillCheck()
    pmove()

def c():
    o.system('clear')

def s(x):
    time.sleep(x)

if __name__ == '__main__':
    load.load_game()
    run(1)
コード例 #17
0
def lvlCheck():
    loa.load_game()
    if cl.Dragon.xp >= math.floor(50 + (cl.Dragon.lvl * 5.25)):
        lvlUp()
    else:
        pass