import random, getpass, sys, time
from IPython.display import clear_output
def ask():
    msg = input()
    return msg

global enemy
enemy = True
global enemy_alive
enemy_alive = True
global enemy_name
enemy_name = "error"
global lower_dm
lower_dm = 0
global uper_dm
uper_dm = 1
global enemy_EXP
enemy_EXP = 0
global turn_count
turn_count = 0
global users_turn
users_turn = True
global Dead
Dead = False
global y
global x
x = 0
y = 0
#player stats
global player_defence
#Make decimal
player_defence = 0
global mana_cap
mana_cap = 0
global health_cap
health_cap = 6
global health
health = 6
global EXP
EXP = 0
global Lv
Lv = 0
global damage
damage = 0
global spaces
spaces = " " * 20
global player_crit
player_crit = False
global enemy_crit
enemy_crit = False
global print_crit
print_crit = False

#Harpy1's starting stats
global set_health
set_health = True
global harpy1
harpy1 = True
global harpy_health
harpy1_health = 5
global harpy1_alive
harpy1_alive = True
#Crab1 varables
#If alive v
global crab1_alive
crab1_alive = True
#enemy health v
global crab1_health
crab1_health = 4
#Sets the players attacks at the start of the game
global mana
mana = 0
global controls
controls = []
controls.append({
    "Movement": "up, down, left, right, north, south, east, west",
    "Actions": "move, stats, location, comands, actions"
})
starter_town_150 = ("""
.......  ......''':;','':c,,:cdOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNNNNNWWWX000Okk
..  .....'.....';;;::;'.,::coxxONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNWNXXNXKOO0OO00
.. ........'....'...;:,.';codkO0XMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNNNXXNX0OOKKOkO0
...... .....'.....'..''..';:lk0KNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWXKKKKKK0OkkOOOOk
  . .....','....',,,;'.''',:lx0NWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXKOO0KK0OOOkOOx
  ...''''.'.....';:;;,'''';:okkOKXNMWMWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXKO0K000OkOkOOx
 ......'..''',,'',,;:;''',,:oxccooxOOXNNNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNX0O0X00KOkkkO0x
..,;'.;;;lo:;:;;:;,;:;,,',,:l:,;:coddOXNNWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNX00OKXXKOO0KXOd
.',,'''''::,:llcll:;::;,'',ldc;clokkdxOK0KNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXXXKOKNX0O0XKOkx
',,;,.....':ccccc:;;;::;,':dxo::dxddooxkkOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWNNNXO0XNK0KKOk0O
;;;,.....'',,'',;:clccl;,:cc::::cloddoox0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXKNMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWNXKNNNX0kxOOx
''''...,ccc:::cc;::::;;;:ccc;;;;:loddddk0NWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOook00KXXKKXXXNWWWWMMMWMMMWMMMMMMMMMMMMWWNNNNNKKXXKXKKOO0kx
......';:;;;;:::::ccc:;;:::ccccc:ccdXXKXNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKdlooloooooddddxkxxO000KXXKKNXXNWNWMMMMMNkdddkKNXXKXXKKOkxxO
.....''''''',,;;,,;;,;;,,;;:clllccoONMMMMWWWMNNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0l;;cool::c:::c::::::clooddooddxkkk0000KK0xooodkKKO0KK00kdoxk
..'',;'.........'',;;,'.',;;;cccc:lkXNNKK0O0XXNWMWNNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNkc;:cclloolcccc:::::::::;::::::::c:::ccllcccllllooddoooooollod
...',,'...........';:;''''''';:::::ldOOdxkdk0XXXKXNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNk:;:ldollllolccccclccccccllcccc:::::::::::;,;;;:;;cllclccc::;;;
..........'........',cc;,''''';:ccccclooodddO0KKO0NNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNx:;clodollllloolcccclcccccclccccc::::::ccccc::::::;:c::clc:::;,,
..................',,cl:;;,',;:;;::;;;;cxkkOKWWWNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXd;;cllldollllollolc:ccllc:cccccccccc:::::::cc:::::;;:::ccccll::;,
'................'''',;:;;:c:;:;:l;,'',:dO0KWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKl,;cllllolclclolllllllcccccccc:cccc::c::::;:::::;;;;::::cllccc;;;:
'................',',,,,;;:c;'.,locl::dkkOKOOXK00KXXXNNNNNNNWWMMMMMMMMMMMMWNKOO0NW0c,;clllllolccclllllllllc::cc:cccccc:::::;::::;;;::::::::::cccc:;;,;
......... ........'.''',,;;'...';dKWXXWMWNk:ldlccclllllolooodxxxkkkOO0000KOkdoodkd:';lllllccllcccclllllllclc:::::cccccc:::::;;:::;;,;:::;;cc::clc:;;,,
 ...................'''',,'.'';c:oXMMMMWNO:..cdolcc:ccccccccccccccclcccccc:::cc:,'';cllccccclccccccllllllccc:,;:::ccccccc::cc:;;::;;,,;;;:ccccccc:,,,,
 ....''..........,'''.',,'.',:c;:xOOKXXKx;...'colcc:;;:::::cccc:::cclccccccccc:;'';clllccc:clccc:cccccllcllc:,,;::::cccccc:ccc::;;:;;;:;;;::cc:;;::;,,
  ...,'..'........''''',,'..,;;;::;;lolc,....,;lolc:;;,;;::::::::::::::ccc::::;',c:ccllcc::ccc::::cccclccclc;'';;,;:::cccc:;:cc:;;;;;::::::::ccc;;;;;,
  .....''.............',;''',''',;;:cc:,....',;;clc;:;;;,;:::;;;;;:::::::::;,'',:c::ccccc::cc::::::ccccc:cc:,'..',,,;:::ccc::ccc::;;;::ccccc::ccccc;;:
 ....'''...;:;'''.....',,'''',,;::cccc;.. ..',,,,clc::::;;;;;;,;;;;::::::;,'..',:c;;:cc:::::;,;;;::::cc::cc:'... .............''',,,;:c:::;;:c::::;;;;
....':;,'...',;;;;,,,'',,'.''''',;:c;,..  ..'',,,;:lc;;;;;;;;;;;;;;::::::;.....';;,,,;;;;;;,,'''',,,,,;;;;;,..                 ......';;::;;:c::ccc:,'
  ...,,'.......,,',:c;,::,',;,'.';:c;'.....',,,;;,,:c:;,,,,,,;;;::::::;;;,'''',,''.......'.................                        ....';:;;;:::::;,,,
........ .......'..,::::cclc:;,,;;;;;,.',,''........',.......................'''''. ........................                       ..;;,;;:::cc:,,,,;;
''..............''',,',;;clc;;;;,'',,,,'.................    ........    ..............''....................           .....      ..,,,,,;::;,,,;;;;,
.......',,....'''.....',;:c:;,,''...'''...................................','...........'.........................   ........... ...'..'',;;;;'.',,;;'
..''..',,'...'''...... ..,,''''......................''.';;,,;;'.......'...'.........'.............................. ...............'...,::,,,,'''',,'
',,,'',;,...'''..........'...................'......',,,cllolll:,..','',''.........................................  ...................,,'','',',',;,
'....';;,'..''......     ................''''''''''',;;;;;;::::c:;;;::;,,,,,,''.''............................'.............................'..','';;.
'....';;,....''...        ......    .....',''....'..''',''',,,,''''''''''''''..'''..................''.....'..''.................................'''..
'.....,,'...'',,'.       .......   ......,;''..........,'..''....................................................................'....................
'''''''',,;:c:;;'.  ..   ................','.............................'''.....................................................''...................
oolc:;,,;cccccc:,......................'..''......................................................'.'.....''.'...................''..............'....
xddolllccccc::cccc:cc:cc:,,;,,,,;;;,;;;;,'',,,,''''''''''........'................................'.'...',''''....'...'''''''''''''..............'....
xxddxxxkkxkxxxxxxxddddddodddddddddoolllllcc:::c:::;;;;;;;;,,,,,,,,'''''..'''......................''....'''','....'....'''''''''''.......''...........
oooodddxxxxxxxxxxkkkkkkkkkkkkkkkkkxxxxxxdddooooollllllcccc::::::;;;;,,,,,,,;,,'''.'''..'..........'..'.......''.',,,,'',,;;;;;;;;,'...''',,,,'.....''.
..':llllloooooodddxxxxxxxxkkxxkkkkkkkkkkOkkkkkkkkkxxxxxxxddooooollcccc:::::c:;;;,,,,,,,,,'',,,,''',',,,,;;,,,,,';c:::::;;;;;;,,,,,,,,,,,,'',''.''.''''
..',;::;;ccc::cclloooooddxddddddxxxxxxxkkkxxxkkkkkkkkkkkkkkkkkkxxxddddddddooolllllccccccccclllllooooooollc::::::c::::::;:;;;:;;;;;;;;;;:;,,,,,,,;;,,,,
...'','',,;;;;:::clllcclllllodddodddxxddxxxxxxxkxxxkkxxxkkxkkkkkkkkkkkkkkkkxkkkkkkxxxxxxxxxxxxxxxxxxxxxxdoooolllollllllllcclcccccccccc:c::;;;;;;;;;,,,
......'',,,;:::ccc:cllllolooooddodddxkxxxxxkxxkkxdxkkxxkkxxkkkkkkxxkxddxkxxxxxkkkxkkxkkkkxkkkxkkkkkkkkkxxxxkxxxxxxxxxxdddooooooooollllccc:::c::;;;::;;
.',,,,,,,,;:::::cc:cllododddddxddxkkkkkkkkxxkkxkkOOOkOOOOOkOOOOOkkkkkxxkkkkOkkOOxxkkkkxkkxxxxkkxxxkkkkxxxxxxxxxxxxxxdddxxxxxxxdddooodddooollooolllcccc
;:;;:::::::cc:ccccllcllloooodxxxxkOO0OOOOOOkOkkkkkkOOOOOOO0000000O000OOOOOOOOOOOOOOOOOOOOkkkkkkkkkkkkkxxxxxkkkkkkkkxxxxxxkkkkkxxxxxxxxxxxxdddddddddddd
:::::cclc::::cccllloolcllllloooodxxkkkkkkkkkkOOOOkkkkkkOOOOOO0OOOO000OOOkkO000O0OOOOOOOOO0OOOOOOOOOOOOOOOkkOOOOOOOOkkxxxkkkkOOkkkkkkkkkxxxxxdxxxxxxxxx
c:::cc:cccccclllclllllcc:clloooddxkkkkkOOOOOOOOO0OxkOOOOOOO0OOO0OOOOOxxkOOOO000OOOOOOOOOOO0OkkkOOOO0OO00OOOOOOOOOOOOOOxxOOOOOOOOkOOOOOkkkkkkkkkkkkkkkx
lc:cllllllllllooollclllloddooodxxxkxdxkOOOOOOOOOOxdkOOOOOkOOOkkO0OO0000O0OOO00OOOOOOOOOO0OOOOOOOOO000000OOOOOOOOOOOOOOOkOOOOOOOOOOOO00OOOOOOOOOOOkkkkO
llccllllllloooolccllloddooooddddxkkkkO0000OOOkOOkxdkOOOOOO0OOO000OOO00KKKK00KKK00000OOOO00OOOOOOO0000000OOOOOOOOOO0000OOOO000O000O000K0OOOOOOOOOOOOOOO
llllloooooloooolloooooodddxxkkkkkOOOO000000000OkkOOOOOOOOOOkkO000OO0000000000OOOO0000000000OOOOOOOO0OO0000000OOOOO000000OOO0000000000K0000OOOkOOOO00OO
loloooolllllllloooooddxxxkkkkkOOOO0000OOO000000OOOOO0000000OOO0000OO0000000000000OOO0000000OOOOOO00OkkkkO00OOOOOOO00000000000000000000000000OOOOOO0OOO
lllloooooolllllllooddxxkxkkkkkkkkkOOOOOO00000000000OO00OOOOOOOOOOOOOO00000000000000000000OO000O000OOkkkkOOOOOOO0000000000K0000000000OO0000OOOOOOO0000O
cclllloollooooooodddxxxxxxkkkkkOOOOOOOOOO000K0000OOkkkOOkkOkkkOOOOOOOOOO00OO000O0000OOOOOOOOOO0O00000000OOO00OO0000000O000000000KKK00000000O000000000O
clllllcc:coodooodxxxxxxxkkkkxkkOOOOOOOOOOO0000O0OOkkkkkkkkOOOOOOOO000OO000OOOOOOOOOOOO00O00OOOOO00OOOO0OOOO00O00000OOOOOO00OO0000K00000000000000000000
loolcllcclddddodxxddxxxxxxkkkkOOOOOOOOOOkOOOOOOOOOOOOkOOOO0OOOOOOO000000000OOkkkOOOO00OOOOOOOOOOOOOOOO0OOOOO000O000000OOOO0000000000000000000000000000
""")


def Stats():
    global users_turn
    global Lv
    global EXP
    global health
    global health_cap
    global punch
    global slash
    global fire_blast

    print("Hp: ",health,"/",health_cap)
    print("Mana: ", mana, "/",mana_cap)
    print("Level: ",Lv)
    print("Exp: ", EXP)
    print("Attacks: ")
    if punch == True:
      print("1) Punch")
    if slash == True:
      print("2) Slash")
    if fire_blast == True:
      print("3) Fire Blast")
    print("Turn: ",turn_count)
    users_turn = True

def Move():
    
    print("Where would you like to go?")
    print("North")
    print("South")
    print("East")
    print("Or West")
    global y
    global x

    rsm = ask()
    if rsm == ("north") or rsm == ("North") or rsm == ("up") or rsm == ("Up"):
        y += 1
    elif rsm == ("south") or rsm == ("South") or rsm == ("down") or rsm == ("Down"):
        y -= 1
    elif rsm == ("west") or rsm == ("West") or rsm == ("left") or rsm == ("Left"):
        x -= 1
    elif rsm == ("east") or rsm == ("East") or rsm == ("right") or rsm == ("Right"):
        x += 1
    
    global users_turn
    users_turn = True

def Location():
    print(x,",",y)

    global users_turn
    users_turn = True

def Comands():
  global users_turn
  print(controls)
  users_turn = True
global level_1
level_1 = False
global level_2
level_2 = False
global level_3
level_3 = False
global level_4
level_4 = False
global level_5
level_5 = False
def Level_Check():
  global health_cap
  global mana_cap
  global EXP
  global Lv
  global punch
  global slash
  global fire_blast
  global level_1
  global level_2
  global level_3
  global level_4
  global level_5
  #Check for if the player has already leveled up
  

  if EXP >= 10 and level_1 == False:
    Lv = 1
    level_1 = True
    EXP = EXP - 10
    slash = True
    health_cap = health_cap + 1
    print("Congratsulation on making it to level 1")
    print("You've learned the way of the sword, Slash, unlocked")
    Level_Check()
  elif EXP >= 30 and level_2 == False:
    Lv = 2
    level_2 = True
    EXP = EXP - 30
    fire_blast = True
    health_cap = health_cap + 2
    mana_cap = mana_cap + 1
    print("Welcome to level 2")
    print("You can now feel the magical energy in your soroundings, Fire Ball, unlocked")
    Level_Check()
  elif EXP >= 50 and level_3 == False:
    Lv = 3
    level_3 = True
    EXP = EXP - 50
    health_cap = health_cap + 4
    mana_cap = mana_cap + 2
    print("You made it to level 3, good")
    Level_Check()
  elif EXP >= 70 and level_4 == False:
    Lv = 4
    level_4 = True
    EXP = EXP - 70
    health_cap = health_cap + 6
    mana_cap = mana_cap + 1
    print("Good job on you, you made it yo level 4, good luck")
    Level_Check()
  elif EXP >= 100 and level_5 == False:
    Lv = 5
    level_5 = True
    EXP = EXP - 100
    health_cap = health_cap + 8
    mana_cap = mana_cap + 1
    print("Level 5, Thats impresive... for a human good luck on getting any more powerful than that")
    Level_Check()
  
  
global punch
punch = True
global fire_blast
fire_blast = False
global slash
slash = False
def Attack():
    global punch
    global slash
    global mana
    global fire_damage
    global fire_blast
    global damage
    global enemy_crit
    global enemy_crit
    global player_crit
    global criz
    global cicc
    global print_crit
    #Names attacks
    print("What move would you like to use?")
    if punch == True:
        print("1) Punch")
    if slash == True:
        print("2) Slash")
    if fire_blast == True and mana >= 1:
        print("3) Fire Blast")
    #Crit role
    criz = random.randrange(1,17)
    if criz == 16:
      player_crit = True
      criz = 0
    cicc = random.randrange(1,17)
    if cicc == 16:
      enemy_crit = True
      cicc = 0
      

    #Check for if the player has the attack and if its the attack they chose
    rsm = ask()
    if rsm == ("punch") or rsm == ("1") and punch == True:
        damage = random.randrange(1,3)
    if rsm == ("slash") or rsm == ("2") and slash == True:
        damage = random.randrange(3,5)
    if rsm ==("fire blast") or rsm == ("3")and fire_blast == True and mana >= 1:
        fire_damage = True
        damage = random.randrange(2,12)
        mana = mana - 1
    
    if player_crit == True:
      damage = damage * 2
      player_crit = False
      print_crit = True
      Enemy()
    else:
      Enemy()


global ent
ent = True
global crab
crab = True
global hawk
hawk = True
global test
test = True
global bear
bear = True
global heart_1
heart_1 = False
global d
d = 1

def Map():
  global y
  global x
  global health
  global health_cap
  global mana
  global mana_cap
  global enemy
  global enemy_health
  global enemy_alive
  global enemy_name
  global lower_dm
  global uper_dm
  global enemy_EXP
  global heart_1
  global test
  global ent
  global crab
  global hawk
  global bear
  global d

  #The players cordnets is set based off of x,y and this is the list of all the places on this grid
  if x == 0 and y == 1:
    clear_output(True)
    print("You see a big mountantan looming in the distance. Its so tall you can't even see the top thats hidden completaly in the clouds")
  elif x == 0 and y == 0:
    clear_output(True)
    print(starter_town_150)
    print("This is your home town. You have lived here for many years and know it like the back of your hand")
    print("You feel rejuvinated")
    health = health_cap
    mana = mana_cap
    print("HP:", health,"/",health_cap, " Mana: ", mana, "/", mana_cap)
  elif x == 0 and y == 2 and enemy == False:
    hawk = False
    enemy = True
  elif x == 0 and y == 2 and hawk == True:
    clear_output(True)
    print("You are attacked...")
    enemy_alive = True
    enemy_name = "Hawk"
    enemy_health = 6 * d
    lower_dm = 1 * d
    uper_dm = 2 * d
    enemy_EXP = 5
    Enemy()
  elif x == 0 and y == -1:
    clear_output(True)
    print("you feel the drop in air presure as you walk down towards the ocean. You feel a shift in terain as you arive at a beach")
  elif x == 0 and y == -2 and enemy == False:
    crab = False
    enemy = True
  elif x == 0 and y == -2 and crab == True:
    clear_output(True)
    print("You are attacked...")
    enemy_alive = True
    enemy_name = "Crab"
    enemy_health = 3 * d
    lower_dm = 0 * d
    uper_dm = 4 * d
    enemy_EXP = 5
    Enemy()
  elif x == 0 and y == -2:
    print("It's a beach")
  elif x == -1 and y == 0:
    print("You head into a dark forest...")
  elif x == -2 and y == 0 and enemy == False:
    ent = False
    enemy = True
  elif x == -2 and y == 0 and ent == True:
    clear_output(True)
    print("You are attacked...")
    enemy_alive = True
    enemy_name = "Ent"
    enemy_health = 7 * d
    lower_dm = 0 * d
    uper_dm = 2 * d
    enemy_EXP = 10
    Enemy()
  elif x == 1 and y == 0 and enemy == False:
    test = False
    enemy = True
  elif x == 1 and y == 0 and test == True:
    clear_output(True)
    print("You are attacked...")
    enemy_alive = True
    enemy_name = "test"
    enemy_health = 1 * d
    lower_dm = 1 * d
    uper_dm = 2 * d
    enemy_EXP = 1000
    Enemy()
  elif x == -1 and y == 3 and enemy == False:
    bear = False
    enemy = True
  elif x == -1 and y == 3 and bear == True:
    clear_output(True)
    print("You are attacked...")
    enemy_alive = True
    enemy_name = "Bear"
    enemy_health = 12 * d
    lower_dm = 2 * d
    uper_dm = 6 * d
    enemy_EXP = 25
    Enemy()
  elif x == 0 and y == 3:
    print("You climb around vast mountans that tower above the clouds")
  elif x == -1 and y == -1 and heart_1 == False:
    heart_1 = True
    health_cap = health_cap + 1
    print("You find a heart amulent on the ground, when you tuch it you feel stronger, +1 Health: ", health_cap)
  elif x == -1 and y == -1 and heart_1 == True:
    print("You see an open feild")


    
#Blank 2.0
def Enemy():
  #Global verables v
  global enemy
  global damage
  global mana
  global health
  global Dead
  global users_turn
  global health_cap
  global mana_cap
  global EXP
  global enemy_crit
  global print_crit
  global enemy_health
  global difficulty
  global lower_dm
  global uper_dm
  #Kills the player if they are less then 0 health
  if health <= 0:
      Dead = True
      users_turn = False
  clear_output(True)
  enemy_health = round(enemy_health)
  lower_dm = round(lower_dm)
  uper_dm = round(uper_dm)
  #Asky art print v
  print()
  enemy_health = enemy_health - damage
  #Displays your damage v
  print("You did: ", damage, "damage")
  if print_crit == True:
    print("You got a critical hit!!!!")
    print_crit = False
  damage = 0
  if enemy_health >= 1:
    enemy_alive = True
  else:
    clear_output(True)
    print("You have defeted the enemy!")
    EXP = EXP + enemy_EXP
    damage = 1
    enemy_alive = False
  dm = random.randrange(lower_dm,uper_dm)
  if enemy_crit == True:
    dm = dm * 2
    print("You got crit!!!!")
    enemy_crit = False
  print("You took: ", dm, "damage")
  health = health - dm
  print(enemy_name,":",enemy_health , "Your HP:", health,"/",health_cap, "Your Mana:", mana,"/",mana_cap)
  if damage == 0 and Dead == False and enemy_alive == True:
    Attack()
  damage = 0
  if enemy_alive == False:
    enemy = False
    Map()



global help_count
help_count = 0

def Help():
  global help_count
  global users_turn
  if help_count == 0 and difficulty != ("Peaceful"):
    print("Hello traveler I see you have asked for my help for the first time")
    print("Let me explain to you how this will work")
    print("When you ask for help I won't just do anything you ask")
    print("All I will do for you is guide you on your quest and give you quips from time to time")
    print("If you still need help ask again and ill give you some guidence but otherwise just go explore and become stronger")



  help_count = help_count + 1
  users_turn = True

global difficulty
difficulty = ("nada")
def Difficulty():
  global difficulty
  global enemy
  global d
  print("What difficulty would you like to play on?")
  print("Peaceful (not recomended) ")
  print("Easy")
  print("Normal")
  print("Hard")
  print("Demon")
  rsm = ask()
  if rsm == ("Peaceful") or rsm == ("peaceful") or rsm == ("p") or rsm == ("1"):
    difficulty = ("Peaceful")
  elif rsm == ("Easy") or rsm == ("easy") or rsm == ("e") or rsm == ("2"):
    difficulty = ("Easy")
  elif rsm == ("Normal") or rsm == ("normal") or rsm == ("n") or rsm == ("3"):
    difficulty = ("Normal")
  elif rsm == ("Hard") or rsm == ("hard") or rsm == ("h") or rsm == ("4"):
    difficulty = ("Hard")
  elif rsm == ("Demon") or rsm == ("demon") or rsm == ("d") or rsm == ("5"):
    difficulty = ("Demon")
  else:
    print("Thats not a choice")
    Difficulty()
  if difficulty == ("Peaceful"):
    d = 0
  if difficulty == ("Easy"):
    d = 0.5
  if difficulty == ("Hard"):
    d = 2
  if difficulty == ("Demon"):
    d = 10

def Intro_Story():
  if difficulty == ("Peaceful"):
    print("Baby")
    time.sleep(.5)
    print("Quit the game and pick something different")
    time.sleep(.7)
    print("The whole game is about the combat")
    time.sleep(.8)
    print("If your on Peaceful you wont be able to level up")
    time.sleep(.8)
    print("Would you like to reset your choice?")
    rsm = ask()
    if rsm == ("Yes") or rsm == ("y") or rsm == ("yes") or rsm == ("sure"):
      Difficulty()
    else:
      print("Well you made your choice have fun not playing the game")
      global ent
      ent = False
      global crab
      crab = False
      global hawk
      hawk = False
      global test
      test = False
      global bear
      bear = False
      global heart_1
      heart_1 = False
      enemy = False
      time.sleep(1)

  if difficulty == ("Easy"):
    print("Not really a chalenge seeker I see")
    time.sleep(.5)
    print("Just don't try to brag when you beat the game")
    time.sleep(.5)
    print("Also if you lose ill totaly make fun of you")
    time.sleep(.5)
    print("Off you go traveler")
    time.sleep(.5)

  if difficulty == ("Normal"):
    print("Hello there travel how are you?")
    time.sleep(.5)
    print("Well it doesn't really mater how you are your jurny will start anyway")
    time.sleep(.5)
    print("I'll start you down in a village, hope that sounds good to you since you don't have a choice")
    time.sleep(.2)
    print("If you need help you can always ask me")
    time.sleep(1)
    print("Also try not to die or I might be seing you again soon")
    time.sleep(.5)
  
  if difficulty == ("Hard"):
    print("Looks like you think this is going to be easy")
    time.sleep(.5)
    print("Or this isnt your first time seeing me")
    time.sleep(.5)
    print("Ether way good luck on doing this")
    time.sleep(.5)
    print("And see you again soon traveler")
    time.sleep(.5)
  
  if difficulty == ("Demon"):
    print("Have fun dying in one hit this world is way too hard for you, not even I could survie here")
    print("Just don't be asking for help here since the is nothing I could do")


while(Dead):
    print("You died better luck next time")
    users_turn = False
    Dead = False
Difficulty()
Intro_Story()
Location()
while(users_turn):
    
    users_turn = False
    turn_count += 1
    
    
    Level_Check()
    
    print("What would you like to do?")
    rsm = ask()
    if rsm == ("stats"):
      Stats()
    elif rsm == ("move"):
      Move()
      Map()
    elif rsm == ("help") or rsm == ("Help"):
      Help()
    elif rsm == ("location") or rsm == ("look") or rsm == ("Location"):
      Map()
      Location()
    elif rsm == ("commands") or rsm == ("actions") or rsm == ("inputs") or rsm == ("command"):
      Comands()
    elif rsm == ("north") or rsm == ("North") or rsm == ("up") or rsm == ("Up"):
      users_turn = True
      y += 1
      Map()
    elif rsm == ("south") or rsm == ("South") or rsm == ("down") or rsm == ("Down"):
      users_turn = True
      y -= 1
      Map()
    elif rsm == ("west") or rsm == ("West") or rsm == ("left") or rsm == ("Left"):
      users_turn = True
      x -= 1
      Map()
    elif rsm == ("east") or rsm == ("East") or rsm == ("right") or rsm == ("Right"):
      users_turn = True
      x += 1
      Map()
    
What difficulty would you like to play on?
Peaceful (not recomended) 
Easy
Normal
Hard
Demon
Thats not a choice
What difficulty would you like to play on?
Peaceful (not recomended) 
Easy
Normal
Hard
Demon
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb Cell 2 in <cell line: 643>()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=640'>641</a>     users_turn = False
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=641'>642</a>     Dead = False
--> <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=642'>643</a> Difficulty()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=643'>644</a> Intro_Story()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=644'>645</a> Location()

/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb Cell 2 in Difficulty()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=558'>559</a> else:
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=559'>560</a>   print("Thats not a choice")
--> <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=560'>561</a>   Difficulty()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=561'>562</a> if difficulty == ("Peaceful"):
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=562'>563</a>   d = 0

/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb Cell 2 in Difficulty()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=545'>546</a> print("Hard")
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=546'>547</a> print("Demon")
--> <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=547'>548</a> rsm = ask()
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=548'>549</a> if rsm == ("Peaceful") or rsm == ("peaceful") or rsm == ("p") or rsm == ("1"):
    <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=549'>550</a>   difficulty = ("Peaceful")

/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb Cell 2 in ask()
      <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a> def ask():
----> <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a>     msg = input()
      <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/refined_code_Game.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a>     return msg

File ~/.local/lib/python3.8/site-packages/ipykernel/kernelbase.py:1177, in Kernel.raw_input(self, prompt)
   1173 if not self._allow_stdin:
   1174     raise StdinNotImplementedError(
   1175         "raw_input was called, but this frontend does not support input requests."
   1176     )
-> 1177 return self._input_request(
   1178     str(prompt),
   1179     self._parent_ident["shell"],
   1180     self.get_parent("shell"),
   1181     password=False,
   1182 )

File ~/.local/lib/python3.8/site-packages/ipykernel/kernelbase.py:1219, in Kernel._input_request(self, prompt, ident, parent, password)
   1216             break
   1217 except KeyboardInterrupt:
   1218     # re-raise KeyboardInterrupt, to truncate traceback
-> 1219     raise KeyboardInterrupt("Interrupted by user") from None
   1220 except Exception:
   1221     self.log.warning("Invalid Message:", exc_info=True)

KeyboardInterrupt: Interrupted by user