Example #1
0
    def choose_action(self, previous_room):

        if (self.hunter.stats['alive'] == True and
            player.stats['alive'] == True):
            choice_ls = ['Give him the treasure', 'Fight!', 'Run away!']
            menu = fn.Menu()
            choice = menu.generate(choice_ls, 'What do you do?')

            if choice == '1':
                player.stats['has_diamond'] = False
                player.stats['has_gold'] = False
                self.hostile = False
                print text.hunter_room['give_gold']
                return self.exit()
            elif choice == '2':
                combat = fn.Combat(player, self.hunter, self.choose_action,
                previous_room)
                return combat.rounds()
            elif choice == '3':
                return previous_room
            else:
                return self.choose_action(previous_room)
        elif player.stats['alive'] == False:
            print text.hunter_room['death_by_hunter']
            return (-1, -1)
        else:
            print "The treasure hunter is dead!"
            print ""
            return self.exit()
Example #2
0
    def choose_action(self):
        action_ls = ["Fiddle with the levers.", "Exit Room."]
        menu = fn.Menu()
        choice = menu.generate(action_ls, "What do you do?")
        ### CHEAT ###
        print "### CHEAT ###"
        print self.code
        ###

        if choice == '1':
            print text.code_room['explain_mechanism']
            print "How do you configure them? (ex: 10101)"
            code = raw_input('> ')

            if code == self.code:
                print text.code_room['cracking_code']
                self.code_cracked = True
                return self.exit()
            else:
                print "This code doesn't seem to do anything."
                return self.choose_action()

        elif choice == '2':
            return self.exit()
        else:
            return self.choose_action()
Example #3
0
    def choose_action(self):
        action_menu = ['Drink from the bottle.', 'Exit the Room.']
        menu = fn.Menu()
        choice = menu.generate(action_menu, 'What do you do?')

        if choice == '1':
            return self.drink_potion()
        elif choice == '2':
            return self.exit()
        else:
            return self.choose_action()
Example #4
0
    def exit(self):
        menu = fn.Menu()
        menu_ls = ['North Door', 'East Door']
        choice = menu.generate(menu_ls, "Which door do you take?")

        if choice == '1':
            return (self.coord[0], self.coord[1] + 1)
        elif choice == '2':
            return (self.coord[0] + 1, self.coord[1])
        else:
            print "Try again."
            return self.exit()
Example #5
0
    def exit(self, coord, menu_ls, room):
        menu = fn.Menu()
        choice = menu.generate(menu_ls, "Which door do you take?")

        if choice == '1':
            return (coord[0], coord[1] + 1)
        elif choice == '2':
            return (coord[0] + 1, coord[1])
        elif choice == '3':
            return (coord[0], coord[1] - 1)
        elif choice == '4':
            return (coord[0] - 1, coord[1])
        else:
            print "Try again."
            instance = room()
            return instance.exit()
Example #6
0
    def enter(self, prev):
        if self.bottle_full == True:
            print text.health_room['intro_bottle_full']
            enter_menu = ["Drink from the bottle.", "Exit the room."]
            menu = fn.Menu()
            choice = menu.generate(enter_menu, "What do you do?")

            if choice == '1':
                player.stats['health'] = player.stats['maxHealth']
                print text.health_room['drink_potion']
                self.bottle_full = False 
                return self.exit()           
            else:
                return self.exit()

        else:
            print text.health_room['intro_bottle_empty']
            return self.exit()
Example #7
0
    def choose_action(self, previous_room):
        enter_menu = ["Try to jump through the pit.", "Run away!"]
        menu = fn.Menu()
        choice = menu.generate(enter_menu, "What do you do?")

        if choice == '1':
            roll = randint(1, 20) + player.stats['agility']

            if roll < 10:
                print text.pit_room['death']
                return (-1, -1)
            else:
                print text.pit_room['pass_through']
                return self.exit()
        
        elif choice == '2':
            return previous_room
        else:
            return self.enter(previous_room)
Example #8
0
    def enter(self, previous_room):
        print text.blades_room['intro']
        enter_menu = ["Try to scurry through the blades.", "Run away!"]
        menu = fn.Menu()
        choice = menu.generate(enter_menu, "What do you do?")

        if choice == '1':
            roll = randint(1, 20) + player.stats['agility']

            if roll < 14:
                print text.blades_room['death']
                return (-1, -1)
            else:
                print text.blades_room['pass_through']
                return self.exit()
        
        elif choice == '2':
            return previous_room
        else:
            self.enter(previous_room)
Example #9
0
    def choose_action(self, previous_room):

        if (self.spider.stats['alive'] == True and
            player.stats['alive'] == True):
            choice_ls = ['Fight!', 'Run away!']
            menu = fn.Menu()
            choice = menu.generate(choice_ls, 'What do you do?')

            if choice == '1':
                combat = fn.Combat(player, self.spider, self.choose_action,
                previous_room)
                return combat.rounds()
            elif choice == '2':
                return previous_room
            else:
                return self.choose_action(previous_room)
        elif player.stats['alive'] == False:
            print text.spider_room['death_by_spider']
            return (-1, -1)
        else:
            print text.spider_room['killing_spider']
            return self.exit()
Example #10
0
    def choose_action(self, previous_room):

        if (self.dragon.stats['alive'] == True and
            player.stats['alive'] == True):
            choice_ls = ['Fight!', 'LEG IT!!!']
            menu = fn.Menu()
            choice = menu.generate(choice_ls, 'What do you do?')

            if choice == '1':
                combat = fn.Combat(player, self.dragon, self.choose_action,
                previous_room)
                return combat.rounds()
            elif choice == '2':
                return previous_room
            else:
                return self.choose_action(previous_room)
        elif player.stats['alive'] == False:
            print text.dragon_room['death_by_dragon']
            return (-1, -1)
        else:
            print "You?! Killed a DRAGON?!?"
            print ""
            return self.exit()
Example #11
0
    def choose_action(self, previous_room):

        if (self.harpy.stats['alive'] == True and
            player.stats['alive'] == True):
            choice_ls = ['Fight!', 'Run away!']
            menu = fn.Menu()
            choice = menu.generate(choice_ls, 'What do you do?')

            if choice == '1':
                combat = fn.Combat(player, self.harpy, self.choose_action,
                previous_room)
                return combat.rounds()
            elif choice == '2':
                return previous_room
            else:
                return self.choose_action(previous_room)
        elif player.stats['alive'] == False:
            print text.harpy_room['death_by_harpy']
            return (-1, -1)
        else:
            print "The harpy dies in an explosion of feathers!"
            print ""
            return self.exit()
Example #12
0
import functions as fungsi

while True:
    try:
        fungsi.logo()
        fungsi.Menu()
        fungsi.Hitung()
        print('=' * 50)

    except ValueError:
        print('=' * 50)
        print('Maaf, Yang Anda Masukan Bukan Angka.')
        print('=' * 50)

    __userAgain = input('Apakah Anda Ingin Menghitung Ulang ? ( Y / N ) : ')
    if __userAgain == 'y' or __userAgain == 'Y':
        continue
    elif __userAgain == 'n' or __userAgain == 'N':
        break
    else:
        print('=' * 50)
        print('Maaf, Kata Kunci Yang Anda Masukan Salah.')
        break

print('=' * 50)
print('TERIMA KASIH')
Example #13
0
        print("Username incorrect!")

# begins the main body of the program
while (login == True):

    if (log == False):
        print(f"Welcome back {name}!")
        print(today)

    log = True

    # checks if the user is the admin
    if (name == "admin"):
        admin = True

    functions.Menu(name)
    option = input("Option: ")
    print("\n")

    # allows the user to register a new user
    if (option == "r"):
        functions.Register(name, users)

    # allows the user to add a new task
    elif (option == "a"):
        functions.AddTask(taskAdd, today)

    # allows the user to check all tasks
    elif (option == "va"):

        functions.ViewAll(tUser, tTitle, tasks, dateA, dateD, tComp)
Example #14
0
"""
This is a little project for starting to learn Python and Logic.
Start: 21/02/2021
Name: Paulo Henrique
Country: Brazil
"""

#--------------------------------------Import Stage--------------------------------------#
import functions
import calculators

#--------------------------------------Menu--------------------------------------#
functions.Menu()
eWhichOneConversion = int(input('\nSelect from 0 - 8: '))
functions.clear()

#--------------------------------------m/s--------------------------------------#
if eWhichOneConversion == 1:
    calculators.MpsToKmph()

elif eWhichOneConversion == 2:
    calculators.KmphToMps()

#--------------------------------------m/h--------------------------------------#
elif eWhichOneConversion == 3:
    calculators.MphToKmph()

elif eWhichOneConversion == 4:
    calculators.KmphToMph()

#--------------------------------------Fps--------------------------------------#