Getting a NameError: name 'cost' is not defined at player.reduce_mp(cost)
elif index == 1:
player.choose_magic()
magic_choice = int(input('Choose magic'))-1
magic_dmg = player.generate_spell_damage()
spell = player.get_spell_name(magic_choice)
cost = player.get_spell_mp_cost(magic_choice)
current_mp = player.get_mp()
if cost > current_mp:
print(bcolors.FAIL + '\nNot enough MP\n' + bcolors.ENDC)
continue
player.reduce_mp(cost)
enemy.take_damage(magic_dmg)
print(bcolors.OKBLUE + '\n' + spell + 'deals', str(magic_dmg), 'points of damage' + bcolors.ENDC)