def gladiator_turn(name_1, name_2): print('{} turn'.format(name_1['Name'].upper())) while True: print('>>>>[A]ttack') print('>>>>[L]evel up') print('>>>>[H]eal') print('>>>>[P]ass') print('>>>>[Q]uit') action = input('{} What would you like to do?'.format( name_1['Name'].upper())) if action == 'A': result = core.attack(name_1, name_2) print(name_1['Name'].upper(), 'Attacks') if result == 'miss': print('{} misses'.format(name_1['Name'], name_2['Name'].upper())) return None if result == 'evade': print('{} evades the attack'.format(name_2['Name'])) return None if result == 'crit': print('critical damage!') print('{} health is now at:{}'.format(name_2['Name'].upper(), name_2['health'])) return None if result == 'hit': print('{} health is now at:{}'.format(name_2['Name'].upper(), name_2['health'])) print('{} rage is now {}'.format(name_1['Name'], name_1['rage'])) return None if action == 'L': result = core.leveled_up(name_1) print('{} has leveled up'.format(name_1['Name'], name_2['Name'])) print('{} is now at level{}'.format(name_1['Name'], name_1['level'])) return None if action == 'H': print(name_1['Name'], 'Heals') core.heal(name_1) print('{} health is now at:{}'.format(name_1['Name'].upper(), name_1['health'])) return None if action == 'P': break if action == 'Q': print('{} has run away'.format(name_1['Name'], name_2['Name'].upper())) quit() else: print('Please choose a valid option!')
def gladiator(name_1, name_2): gladiator_one = core.new_gladiator(100, 0, 19, 33) gladiator_two = core.new_gladiator(100, 0, 20, 33) while True: print(name_1, gladiator_one['health'], 'hp', '!!!', gladiator_one['rage'], 'rage') print(name_2, gladiator_two['health'], 'hp', '!!!', gladiator_two['rage'], 'rage\n') while True: print('\nplayer one:\n {} your turn'.format(name_1)) response = input( 'Would you like to{}...???\n 1.[A]ttack, 2.[P]ass, 3.[Q]uit, 4.[H]eal' ) if response == 'A': core.attack(gladiator_one, gladiator_two) print('gladiator_two health', gladiator_two['health']) break elif response == 'P': break elif response == 'Q': return elif response == 'H': core.heal(gladiator_one) if core.is_dead(gladiator_two): print('{}: YOU WIN!'.format(name_1)) print('POOR TINK-TINK, YOU\'RE DEAD!!!!!') print('**~~~~GAME OVER~~~~**') break while True: print('\nplayer two:\n {} your turn'.format(name_2)) response = input( 'Would you like to...???\n 1.[A]ttack, 2.[P]ass, 3.[H]eal], 4.[Q]uit' ) if response == 'A': core.attack(gladiator_two, gladiator_one) print('gladiator_one health', gladiator_one['health']) break elif response == 'P': break elif response == 'Q': return elif response == 'H': core.heal(gladiator_two) if core.is_dead(gladiator_one): print('{}: YOU WIN!'.format(name_2)) print('POOR TINK-TINK, YOU\'RE DEAD!!!!!\n') print('**~~~~GAME OVER~~~~**\n') break
def gladiator(): glad = core.new_gladiator gladiator_1 = glad(100, 0, 10, 25) gladiator_2 = glad(100, 0, 10, 25) while True: while True: print('\nGladiator 1 your turn!\n') print('Gladiator 1', gladiator_1['health'], 'HP', '|||', 'Gladiator 1', gladiator_1['rage'], 'rage') response = input( '\nGladiator 1 what would you like to attack, heal, pass, or quit?\n' ).strip().lower() if response == 'a' or response == 'attack': core.attack(gladiator_1, gladiator_2) break elif response == 'h' or response == 'heal': core.heal(gladiator_1) break elif response == 'p' or response == 'pass': break elif response == 'q' or response == 'quit': return if core.is_dead(gladiator_2): print('Gladiator 1 Wins!') break while True: print('\nGladiator 2 your turn!\n') print('Gladiator 2', gladiator_2['health'], 'HP', '|||', 'Gladiator 2', gladiator_2['rage'], 'rage') response = input( '\nGladiator 2 what would you like to attack, heal, pass, or quit?\n' ).strip().lower() print('--------------------------------------------------') if response == 'a' or response == 'attack': core.attack(gladiator_2, gladiator_1) break elif response == 'h' or response == 'heal': core.heal(gladiator_2) break elif response == 'p' or response == 'pass': break elif response == 'q' or response == 'quit': return if core.is_dead(gladiator_1): print('Gladiator 2 Wins!') break
def gladiator_turn(attacker, defender): while True: core.defend_counter(attacker) if attacker['stunned_status']: if attacker['stunned_turns'] == 0: show_gladiators(attacker, defender) attacker['stunned_status'] = '' continue else: print("{} is stunned for {} turns)".format( attacker['gladiator_name'], attacker['stunned_turns'])) attacker['stunned_turns'] -= 1 pass else: show_gladiators(attacker, defender) gladiator_move = gladiator_makes_move(attacker, defender) if gladiator_move == 'a': core.attack(attacker, defender) elif gladiator_move == 'supah kick': #negative health test defender['health'] -= 99 elif gladiator_move == 'angery': #crit hit test attacker['rage'] += 100 continue elif gladiator_move == 'h': if attacker['rage'] < 10: print("You try to heal, but you just aren't angry enough") elif attacker['health'] == 100: print( "You spend some time searching for wounds to self-treat, but no serious ones are found." ) else: core.heal(attacker) elif gladiator_move == 'p': pass if core.is_dead(defender): print('{} has died. Funeral procession tommorrow... {} Wins!'. format(defender['gladiator_name'], attacker['gladiator_name'])) break defender, attacker = attacker, defender
def battle(attacker, attacker_stats, defender, defender_stats): check_the_dead(attacker, attacker_stats, defender, defender_stats) while True: print('----------------------------------------') display_stats(attacker, attacker_stats) display_stats(defender, defender_stats) print('\n----------------------------------------') action = input( '\n{},what would you like to do?\n>>> 1) Attack(+15 Rage)\n>>> 2) Heal(-10 Rage,+10 Health)\n>>> 3) Cast(-10 Magic,-10 Enemy Health,+10 Health)\n>>> 4) Pass(+15)\n>>> 5) Quit\n' .format(attacker.strip().capitalize())) if action.lower() == '1': core.attack(attacker_stats, defender_stats) break if action.lower() == '2': if core.heal(attacker_stats) == None: print('\nYou Can Not Complete That Action!!!') else: core.heal(attacker_stats) break if action.lower() == '3': if core.cast(attacker, attacker_stats, defender, defender_stats) == None: print('You Do Not Posses The Magic!!!') elif core.cast(attacker, attacker_stats, defender, defender_stats) == True: break if action.lower() == '4': print('\nYou\'ve chosen to show mercy upon your enemy.\n') attacker_stats['Magic'] = attacker_stats['Magic'] + 15 break if action.lower() == '5': print( '\nYou lay down your weapons and ask for mercy from your opponent.\n' ) print('{} Is Victorious!!!'.format(defender.strip().capitalize())) exit() else: print('\nIncorrect Input!!!')
def main(): name_1 = input('Name your fighter Player 1. ') gladiator_1 = core.new_gladiator(name_1, 100, 10, 15, 25) print('Welcome to Mortal Kombat,', (name_1)) name_2 = input('Name your fighter Player 2. ') gladiator_2 = core.new_gladiator(name_2, 100, 10, 15, 25) print('Welcome to Mortal Kombat,', (name_2)) while not (core.is_dead(gladiator_1) or core.is_dead(gladiator_2)): show_gladiators(gladiator_1, gladiator_2) player_1_choice = get_choice() if player_1_choice == 'Attack': print(gladiator_1['name'], 'ATTACKS!') core.attack(gladiator_1, gladiator_2) elif player_1_choice == 'Pass': print(gladiator_1['name'], 'Passes!') elif player_1_choice == 'Heal': print(gladiator_1['name'], 'Heals!') core.heal(gladiator_1) elif player_1_choice == 'Quit': print(gladiator_2['name'], 'Wins... Quitality.') exit() show_gladiators(gladiator_2, gladiator_1) player_2_choice = get_choice() if player_2_choice == 'Attack': print(gladiator_2['name'], 'ATTACKS!') core.attack(gladiator_2, gladiator_1) elif player_2_choice == 'Pass': print(gladiator_2['name'], 'Passes!') elif player_2_choice == 'Heal': print(gladiator_2['name'], 'Heals!') core.heal(gladiator_2) elif player_2_choice == 'Quit': print(gladiator_1['name'], 'Wins... Quitality.') exit() battle(name_1, gladiator_1, name_2, gladiator_2)
def test_heal(): choice = {'health': 100, 'rage': 15, 'damage_low': 10, 'damage_high': 20} assert core.heal(choice) == None
def gladiator(): print("----THE HAVOC STADIUM----") print("....setting up the game....") gladiator_1 = core.new_gladiator(100, 0, 10, 50) gladiator_2 = core.new_gladiator(100, 0, 5, 60) # print("*GLADIATOR 1*") while True: message = input( "**Before you start, choose your armor to battle with: \n *The Enclosed Helmet![1] \n *The Pavise Shield![2] \n *The Girdle of MIGHT![3] \n" ).strip() if message == 'The Enclosed Helmet' or message == '1': print("You have chosen the mighty ", core.armor('Enclosed Heart'['nsame'])) break print("*GLADIATOR 1*") while True: # whole game play loop if core.is_dead(gladiator_1): print("Gladiator 1 has died, always in our hearts.") print("~~~GLADIATOR 2 WINS~~~") break while True: # everything dealing with gladiator 1s turn print('Gladiator 1:', gladiator_1['health'], "HP", "||", gladiator_1['rage'], "Rage") print("Gladiator 2:", gladiator_2['health'], "HP", "||", gladiator_2['rage'], "Rage") response = input( "What would you lke to do? \n >> [a]ttack \n >> [p]ass \n >> [q]uit \n >> [h]eal \n " ).strip().lower() if response == 'attack' or response == 'a': core.attack(gladiator_1, gladiator_2) print("You attacked Player 2, their health is now decreased!") print("Player 2's Health:", gladiator_2['health']) break elif response == 'pass' or response == 'p': print("You have passed to Gladiator 2!") break elif response == 'quit' or response == 'q': print("Hope you come to battle later!!") print("***QUITTING***") return elif response == 'heal' or response == 'h': core.heal(gladiator_1) print("You have healed your health!") print("Player 1's Current Health:", gladiator_1['health']) else: print("Invalid choice, pick a valid choice to fight!!") if core.is_dead(gladiator_2): print("~~~GLADIATOR 1 WINS~~~") print("Gladiator 2 has died, always in our hearts.") break print("-----------------------------------") print("*GLADIATOR 2*") print('Gladiator 1:', gladiator_1['health'], "HP", "||", gladiator_1['rage'], "Rage") print("Gladiator 2:", gladiator_2['health'], "HP", "||", gladiator_2['rage'], "Rage") while True: # everything with the second glads turn response = input( "What would you lke to do? \n >> [a]ttack \n >> [p]ass \n >> [q]uit \n >> [h]eal \n " ).strip().lower() if response == 'attack' or response == 'a': core.attack(gladiator_2, gladiator_1) print("You attacked Player 1, their health is now decreased!") print("Player 1's Health:", gladiator_1['health']) print("*GLADIATOR 1*") break elif response == 'pass' or response == 'p': print("You have passed to Gladiator 1!") print("*GLADIATOR 1*") break elif response == 'quit' or response == 'q': print("Hope you come to battle later!!") print("***QUITTING***") return elif response == 'heal' or response == 'h': core.heal(gladiator_1) print("You have healed your health!") print("Player 2's Current Health:", gladiator_2['health']) print("*GLADIATOR 1*") else: print("Invalid choice, pick a valid choice to fight!!")
def main(): Gladiator_start() gladiator_one = core.new_gladiator(100, 0, 12, 20) gladiator_two = core.new_gladiator(100, 0, 5, 30) while True: choice = gladiator_choice('1') if choice.lower() == '1': core.attack(gladiator_one, gladiator_two) if core.is_dead(gladiator_two): print('K.O. gladiator 1 wins') break elif choice.lower() == '3': print('Gladiator 1 looses') print('Gladiator 2 wins') exit() elif choice.lower() == '4': core.heal(gladiator_one) elif choice.lower() == '5': if core.supe_heal(gladiator_one): print('you have succesfully heal.\n') else: print( 'Sorry you do not enough rage. you need 30 or more to complete super heal.\n' ) elif choice.lower() == '2': core.pass_rage(gladiator_one) print('gladiator 1 pass') elif choice.lower() == '6': core.punch(gladiator_one, gladiator_two) if core.is_dead(gladiator_two): print('K.O. gladiator 1 wins') break else: print('Invalid choice.') Gladiators1_details(gladiator_one) Gladiators2_details(gladiator_two) choice = gladiator_choice('2') if choice.lower() == '1': core.attack(gladiator_two, gladiator_one) if core.is_dead(gladiator_one): print('K.O. gladiator 2 wins') break elif choice.lower() == '3': print('Gladiator 2 looses') print('Gladiator 1 wins') exit() elif choice.lower() == '4': core.heal(gladiator_two) elif choice.lower() == '5': if core.supe_heal(gladiator_one): print('you have succesfully heal.\n') else: print( 'Sorry you do not enough rage. you need 30 or more to complete super heal.\n' ) elif choice.lower() == '2': core.pass_rage(gladiator_two) print('gladiator 2 pass') elif choice.lower() == '6': core.punch(gladiator_two, gladiator_one) if core.is_dead(gladiator_one): print('K.O. gladiator 1 wins') break else: print('Invalid choice.\n') Gladiators1_details(gladiator_one) Gladiators2_details(gladiator_two)
def test_heal(): gladiator = {'Health': 100, 'Rage': 0} core.heal(gladiator) assert gladiator['Rage'] >= 0 assert gladiator['Health'] == 100