コード例 #1
0
ファイル: cleric_test.py プロジェクト: zeibl/Course
 def test_inheritance(self):
     cleric = Cleric('Test', 100, 10)
     self.assertEqual(cleric.hp, 100)
コード例 #2
0
ファイル: cleric_test.py プロジェクト: zeibl/Course
 def test_heal(self):
     cleric = Cleric('Test', 100, 10)
     other = Cleric('Other', 100, 10)
     cleric.heal(other)
     self.assertEqual(other.hp, 110)
コード例 #3
0
ファイル: cleric_test.py プロジェクト: zeibl/Course
 def test_existance(self):
     cleric = Cleric('Test', 100, 10)
コード例 #4
0
ファイル: cleric_test.py プロジェクト: florimaros/florimaros
 def test_inheritance(self):
     cleric = Cleric("Test", 100, 10)
     other = Cleric("Other", 100, 10)
     cleric.heal(other)
     self.assertEqual(other.hp, 110)
コード例 #5
0
 def test_heal(self):
     cleric = Cleric('Test', 100, 10)
     other = Cleric('Test', 100, 10)
     cleric.heal(other)
     self.assertEqual(other.hp, 110)
コード例 #6
0
ファイル: cleric_test.py プロジェクト: glukocerin/mrakosms
 def test_can_heal(self):
     character = Character('Test', 100, 10)
     cleric = Cleric('TestCleric', 100, 10)
     cleric.heal(character)
     self.assertEqual(character.hp, 110)
コード例 #7
0
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())
コード例 #8
0
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