def test_inheritance(self): cleric = Cleric('Test', 100, 10) self.assertEqual(cleric.hp, 100)
def test_heal(self): cleric = Cleric('Test', 100, 10) other = Cleric('Other', 100, 10) cleric.heal(other) self.assertEqual(other.hp, 110)
def test_existance(self): cleric = Cleric('Test', 100, 10)
def test_inheritance(self): cleric = Cleric("Test", 100, 10) other = Cleric("Other", 100, 10) cleric.heal(other) self.assertEqual(other.hp, 110)
def test_heal(self): cleric = Cleric('Test', 100, 10) other = Cleric('Test', 100, 10) cleric.heal(other) self.assertEqual(other.hp, 110)
def test_can_heal(self): character = Character('Test', 100, 10) cleric = Cleric('TestCleric', 100, 10) cleric.heal(character) self.assertEqual(character.hp, 110)
from barbarian import Barbarian from character import Character from cleric import Cleric i = Barbarian("Conan", 5, 10) z = Character("Herkules", 50, 20) b = Cleric ("Cler", 50, 30) i.strike(z) z.strike(b) b.heal(z) print(z.hp) print(i.get_status()) print(z.get_status()) print(b.get_status())
def load_champion(): # print("Enter Champions Type") # ch_type = input(">> ") # print("Enter Champions name") # ch_name = input(">> ") jsonfiles = [] for f in glob.glob("*.json"): jsonfiles.append(f) if jsonfiles == []: print("\nNo champions saved\n") input("Press enter to continue") return None print("===== Load Champion =====") for i, n in enumerate(jsonfiles): print("{}-{}".format(i + 1, n[:-5])) try: print("*Any other option to go back") l_op = int(input(">> ")) l_op -= 1 if l_op < 0 or l_op >= len(jsonfiles): raise Exception except: # os.system("clear") # print("\nWrong option\n") # input("Press enter to continue") return None champ_f = jsonfiles[l_op][:-5].split("_") ch_type = champ_f[0] ch_name = champ_f[1] ch_dict = BaseChampion.load_character(ch_type, ch_name) if ch_dict == {}: print("no champion found") return None if ch_type == "Cleric": my_champ = Cleric(ch_dict["name"], ch_dict["raze"], ch_dict["gender"], ch_dict["level"], ch_dict["nv_exp"], ch_dict["current_exp"], ch_dict["total_exp"], ch_dict["stat_points"]) if ch_type == "Paladin": my_champ = Paladin(ch_dict["name"], ch_dict["raze"], ch_dict["gender"], ch_dict["level"], ch_dict["nv_exp"], ch_dict["current_exp"], ch_dict["total_exp"], ch_dict["stat_points"]) if ch_type == "Figther": my_champ = Figther(ch_dict["name"], ch_dict["raze"], ch_dict["gender"], ch_dict["level"], ch_dict["nv_exp"], ch_dict["current_exp"], ch_dict["total_exp"], ch_dict["stat_points"]) if ch_type == "Mage": my_champ = Mage(ch_dict["name"], ch_dict["raze"], ch_dict["gender"], ch_dict["level"], ch_dict["nv_exp"], ch_dict["current_exp"], ch_dict["total_exp"], ch_dict["stat_points"]) if ch_type == "Rogue": my_champ = Rogue(ch_dict["name"], ch_dict["raze"], ch_dict["gender"], ch_dict["level"], ch_dict["nv_exp"], ch_dict["current_exp"], ch_dict["total_exp"], ch_dict["stat_points"]) if ch_type == "Ranger": my_champ = Ranger(ch_dict["name"], ch_dict["raze"], ch_dict["gender"], ch_dict["level"], ch_dict["nv_exp"], ch_dict["current_exp"], ch_dict["total_exp"], ch_dict["stat_points"]) my_champ.stats = ch_dict["stats"] os.system("clear") print(my_champ) input("Press enter to continue") return my_champ