print( "-----------------------------" ) print( "Troll attack:" ) import random health = 100 troll_health = 100 print() print( "You are attacked by a troll!" ) print( "Your health:", health ) while health > 0 and troll_health > 0: print() print( "The troll swings his axe" ) damage = random.randint( 5, 20 ) chance = int(input('type in a random number between 1 and 3: '))/random.randint ( 1, 3 ) print() if chance == 1: print('You dodged and managed to hit him.') damage_to_troll = random.randint( 5, 20 ) critical = int(input('type in a random number between 1 and 3: '))/random.randint ( 1, 3 ) if critical == 1: damage_to_troll = damage_to_troll*2 print() print('You managed to hit a vital point, two times damage') print('You stabbed him and he took', damage_to_troll, 'damage.') troll_health = troll_health - damage_to_troll else: health = health - damage print('You failed to dodge') print( "You took", damage, "damage" ) print("Your health:", health ) print( 'The trolls health:', troll_health ) if health < 0: print() print( "You are DEAD!" ) else: print() print('You killed the troll!')