def setUp(self): weapon = Weapon('Dagger', 10, 0.0) hero = Hero('Asd', 100, 'Hero') hero.equip_weapon(weapon) orc = Orc('Dsa', 1, 1.4) orc.equip_weapon(weapon) self.fight = fight.Fight(hero, orc)
def setUp(self): self.dummy_human = hero.Human("Android", 2500, "the master race") self.dummy_orc = hero.Orc("iOS", 3300, 1.3) self.fight = fight.Fight(self.dummy_human, self.dummy_orc) self.dummy_human.equip_weapon( weapon.Weapon("Sword of a Thousand Truths", 480, 0.4)) self.dummy_orc.equip_weapon(weapon.Weapon("Aeglos", 390, 0.1))
def test_simulate_fight(self): hero1 = hero.Hero("Hero", 100, "WOW") orc1 = orc.Orc("Orc", 20, 1.5) sword = entity.Weapon("sword", 20, 0.4) hero1.equip_weapon(sword) fight1 = fight.Fight(hero1, orc1) winner = fight1.simulate_fight() self.assertEqual("Hero", winner)
def setUp(self): self.sword = weapon.Weapon("Oathkeeper", 85, 0.1) self.axe = weapon.Weapon("Mighty Axe", 30, 0.2) self.crackhag_orc = orc.Orc("Crackhag", 120, True, 120, 1.5) self.bron_hero = hero.Hero("Bron", 120, "DragonSlayer", True, 120) self.crackhag_orc.equip_weapon(self.sword) self.bron_hero.equip_weapon(self.axe) self.battle = fight.Fight(self.bron_hero, self.crackhag_orc)
def get_play(): name = input("Как твоё имя?") straight = int(input("Выбери силу")) pl = player.Player(name=name, straight=straight) mn = monster.Monster(name=name, mtype=0, straight=straight) fig = fight.Fight(pl, mn) fig.tick() print(pl.hp)
def setUp(self): black_orc = orc.Orc("Cho_gath", 150, 1.2) white_hero = hero.Hero("Jinx", 150, "Loose Cannon") self.arena = fight.Fight(white_hero, black_orc)
def move(self, player_name, direction): position = self.__players[player_name] boundary = len(self.map[0]) if direction == 'up': if position[0] > 0: if self.map[position[0] - 1][position[1]] == '#': return False elif self.map[position[0] - 1][position[1]] == '.': self.__swap(position[0], position[1], direction, player_name) self.__players[player_name] = (position[0] - 1, position[1]) return True elif(self.map[position[0] - 1][position[1]] == 'H' or self.map[position[0] - 1][position[1]] == 'O'): for player in self.__players: if self.__players[player] == (position[0] - 1, position[1]): meeted_player = player return fight.Fight(self.__player_stats[player_name], self.__player_stats[meeted_player]).simulate_fight() else: return False elif direction == 'left': if position[1] > 0: if self.map[position[0]][position[1] - 1] == '#': return False elif self.map[position[0]][position[1] - 1] == '.': self.__swap(position[0], position[1], direction, player_name) self.__players[player_name] = (position[0], position[1] - 1) return True elif(self.map[position[0]][position[1] - 1] == 'H' or self.map[position[0]][position[1] - 1] == 'O'): for player in self.__players: if self.__players[player] == (position[0], position[1] - 1): meeted_player = player return fight.Fight(self.__player_stats[player_name], self.__player_stats[meeted_player]).simulate_fight() else: return False elif direction == 'down': if position[0] < boundary - 1: if self.map[position[0] + 1][position[1]] == '#': return False elif self.map[position[0] + 1][position[1]] == '.': self.__swap(position[0], position[1], direction, player_name) self.__players[player_name] = (position[0] + 1, position[1]) return True elif(self.map[position[0] + 1][position[1]] == 'H' or self.map[position[0] + 1][position[1]] == 'O'): meeted_player = entity.Entity("Goshu" , 1) for player in self.__players: if self.__players[player] == (position[0] + 1, position[1]): meeted_player = player return fight.Fight(self.__player_stats[player_name], self.__player_stats[meeted_player]).simulate_fight() else: return False else: if position[1] < boundary - 1: if self.map[position[0]][position[1] + 1] == '#': return False elif self.map[position[0]][position[1] + 1] == '.': self.__swap(position[0], position[1], direction, player_name) self.__players[player_name] = (position[0], position[1] + 1) return True elif(self.map[position[0]][position[1] + 1] == 'H' or self.map[position[0]][position[1 + 1]] == 'O'): for player in self.__players: if self.__players[player] == (position[0], position[1] + 1): meeted_player = player return fight.Fight(self.__player_stats[player_name], self.__player_stats[meeted_player]).simulate_fight() else: return False
def setUp(self): self.orc_one = orc.Orc("Trebble", 100, 3.4) self.hero_one = hero.Hero("Dork", 100, "DragonSlayer") self.orc_one.weapon = weapon.Weapon("Axe", 20, 0.2) self.hero_one.weapon = weapon.Weapon("Sword", 10, 0.8) self.fight_one = fight.Fight(self.hero_one, self.orc_one)
def setUp(self): bad_orc = orc.Orc("Emil", 150, 0.6) good_hero = hero.Hero("Naso", 160, "The Slayer") self.arena = fight.Fight(bad_orc, good_hero)
def setUp(self): self.hero_test = hero.Hero("Teddy", 500, "Bear") self.orc_test = orc.Orc("Grom", 100, 2) self.weapon_test = weapon.Weapon("Gorehowl", 25, 0.5) self.fight = fight.Fight(self.hero_test, self.orc_test)