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
def test_strike(self): barbarian = Barbarian('Conan', 100, 10) opponent = Barbarian('Herkules', 100, 10) barbarian.strike(opponent) self.assertEqual(opponent.hp, 80)
def test_strike(self): barbarian = Barbarian('TestBarbarian', 100, 10) enemy = Character('TestEnemy', 100, 10) barbarian.strike(enemy) self.assertEqual(enemy.hp, 80)
def test_strike(self): barbarian = Barbarian("Conan", 100, 10) opponent = Barbarian("Herculaes", 100, 10) barbarian.strike(opponent) self.assertEqual(opponent.hp, 80)
def test_inheritance(self): barbarian = Barbarian('Conan', 100, 10) self.assertEqual(barbarian.hp, 100)
# 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.")
def test_existance(self): barbarian = Barbarian('Conan', 100, 10)
def test_strike(self): barbarian = Barbarian('Conan', 100, 10) opponent = Barbarian('Hercules', 100, 10) barbarian.strike(opponent) self.assertEqual(opponent.hp, 80)
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 test_strike(self): barbarian = Barbarian("Conan", 100, 10) enemy = Barbarian("Xena", 100, 10) barbarian.strike(enemy) self.assertEqual(enemy.hp, 80)
def test_strike(self): barbarian = Barbarian("Test", 100, 10) opponent = Barbarian("Bela", 100, 10) barbarian.strike(opponent) self.assertEqual(opponent.hp, 80)