Exemple #1
0
    def createCharacter(self, teamNum):
        print("Pick Team %s Character by selecting from below: \n" % teamNum)
        print("1) Vampire\n")
        print("2) Barbarian\n")
        print("3) BlueMen\n")
        print("4) Medusa\n")
        print("5) HarryPotter\n\n")

        choice = 0

        while choice !=1 and choice != 2 and choice != 3 and choice != 4 and choice != 5:
            try:
                choice = int(input("Input the character number that you select:  "))
            except:
                choice = 0

        characterName = input("Enter character name:  ")

        if choice is 1:
            character = Vampire(characterName)
            return character

        elif choice is 2:
            character = Barbarian(characterName)
            return character

        elif choice is 3:
            character = BlueMen(characterName)
            return character

        elif choice is 4:
            character = Medusa(characterName)
            return character

        elif choice is 5:
            character = HarryPotter(characterName)
            return character
    # Allows user to choose what class their character is and resets character#####
    characterClass = None
    while characterClass not in ('bard', 'wizard', 'fighter', 'rogue',
                                 'barbarian'):
        characterClass = input('What Class Do You Want'
                               '(Barbarian, Bard, Fighter,'
                               'Rogue, or Wizard)? ').lower()
###############################################################################

# Branching Paths allow user to choose sub class appropriate to chosen class

# Barbarian Class Branch#######################################################
    if (characterClass.lower() == 'barbarian'):
        player = Barbarian(player.strength, player.constitution,
                           player.dexterity, player.intelligence,
                           player.wisdom, player.charisma)
        print(player.getStats())
        answer = None
        while answer not in ("totem", "tank"):
            answer = input("What Sub Class (Totem or Tank): ").lower()
            if (answer == "totem"):
                player = Totem(player.strength, player.constitution,
                               player.dexterity, player.intelligence,
                               player.wisdom, player.charisma)
            elif (answer == "tank"):
                player = Tank(player.strength, player.constitution,
                              player.dexterity, player.intelligence,
                              player.wisdom, player.charisma)
            else:
                print("Please enter Totem or Tank.")
Exemple #3
0
 def test_existance(self):
     barbarian = Barbarian('Conan', 100, 10)
Exemple #4
0
 def test_inheritance(self):
     barbarian = Barbarian('Conan', 100, 10)
     self.assertEqual(barbarian.hp, 100)
Exemple #5
0
 def test_strike(self):
     barbarian = Barbarian('Conan', 100, 10)
     opponent = Barbarian('Hercules', 100, 10)
     barbarian.strike(opponent)
     self.assertEqual(opponent.hp, 80)