def random_opponent(self): """randomly choosing an opponent""" opp_chars = {1: heavy, 2: cat, 3: rogue, 4: giant, 5: amazon, 6: two_orc} # pre-built characters opp_roll = die6() return opp_chars[opp_roll]
return standard elif chosen_style in range(4, 6): return aggressive elif chosen_style == 6: return defensive elif chosen_style in range(7, 9): return strong elif chosen_style == 9: return furious elif chosen_style == 10: return parry else: return standard """ Predefined opponents """ heavy = Character("Bruno", "heavily-armored knight", "", sword, 15, 4, 12, standard) cat = Character("Leonardo", "agile catling swashbuckler", "", rapier, 11, 7, 11, standard) rogue = Character("Ratty", "dirty fighting rogue", "", sabre, 15, 6, 9, standard) giant = Character("Ka-haak", "giant,slow but strong", "", great_club, 30, 4, 8, standard) amazon = Character("Sheila", "amazon lancer", "", lance, 13, 5, 10, standard) two_orc = Character("Grim and Grum", "two orcish raiders", "They are two, so they attack twice a round.", two_sabres, 16, 4, 9, standard) """ Predefined players """ random_character = Character("", "newbie adventurer", "", "random_weapon(self)", die6() + 10, die6() // 3 + 4, die6() // 3 + 9, standard) p_heavy = Character("Desmond", "heavily-armored knight", "", sword, 15, 4, 12, standard) p_cat = Character("Bubbles", "agile catling swashbuckler", "", rapier, 11, 7, 11, standard) p_rogue = Character("Louis", "dirty fighting rogue", "", sabre, 15, 6, 9, standard) p_giant = Character("Tul-duru", "giant,slow but strong", "", great_club, 30, 4, 8, standard) p_amazon = Character("Noelle", "amazon lancer", "", lance, 13, 5, 10, standard) p_two_orc = Character("Shargat and Gobrath", "two orcish raiders", "They are two, so they attack twice a round.", two_sabres, 12, 0, 4, standard)