def play(): skeleton = Monster('Skeleton', 50, 10, 0) player = Player() skeleton.attack(player) player.attack(skeleton) player.attack(skeleton) player.attack(skeleton) player.attack(skeleton)
def __init__(self): Monster.__init__(self) self.name = "Snakeling" self.max_hp = 20 self.attack_damage = '4d4' self.thaco = 12 self.ac = 20 self.agility = 15 self.exp_value = 15 self.gold = '3d6' self.dmesg = 'It lashes out'
def __init__(self): Monster.__init__(self) self.name = "Teenage Ninja Kobold" self.max_hp = 10 self.attack_damage = '4d6' self.thaco = 10 self.ac = 15 self.agility = 18 self.exp_value = 15 self.gold = '2d6' self.dmesg = 'It uses REAL ULTIMATE NINJA POWER against you'
def __init__(self): Monster.__init__(self) self.name = "Kobold" self.max_hp = 10 self.attack_damage = '4d4' self.thaco = 12 self.ac = 12 self.agility = 14 self.exp_value = 10 self.gold = '3d6' self.dmesg = 'It slashes with a vicious dagger,'
def __init__(self): Monster.__init__(self) self.name = "Jelly Fish" self.max_hp = 15 self.attack_damage = '2d4' self.thaco = 15 self.ac = 10 self.agility = 8 self.exp_value = 4 self.gold = '1d6' self.dmesg = 'You are enveloped in stinging tentacles,'
def __init__(self): Monster.__init__(self) self.name = "Giant Slug" self.max_hp = 10 self.attack_damage = '2d3' self.thaco = 18 self.ac = 12 self.agility = 10 self.exp_value = 3 self.gold = '2d4' self.dmesg = 'You slip on a puddle of slime'
def __init__(self): Monster.__init__(self) self.name = "Snotling" self.max_hp = 6 self.attack_damage = '1d4' self.thaco = 20 self.ac = 10 self.agility = 14 self.exp_value = 2 self.gold = '1d6' self.dmesg = 'The Snotling discharges its nose at you'
def __init__(self): Monster.__init__(self) self.name = "The evil Minotaur" self.max_hp = 75 self.attack_damage = '10d6' self.thaco = 0 self.ac = 30 self.agility = 30 self.exp_value = 250 self.gold = '20d20' self.dmesg = 'It throws you against the wall'
def __init__(self): Monster.__init__(self) self.name = "Henchman" self.max_hp = 32 self.attack_damage = '8d4' self.thaco = 6 self.ac = 25 self.agility = 20 self.exp_value = 35 self.gold = '10d6' self.dmesg = 'He slashes at you'
def __init__(self): Monster.__init__(self) self.name = "Dark Apprentice" self.max_hp = 25 self.attack_damage = '4d6' self.thaco = 6 self.ac = 25 self.agility = 20 self.exp_value = 28 self.gold = '5d6' self.dmesg = 'He slashes at you'
def __init__(self): Monster.__init__(self) self.name = "Guardsman" self.max_hp = 22 self.attack_damage = '4d6' self.thaco = 10 self.ac = 20 self.agility = 18 self.exp_value = 20 self.gold = '5d6' self.dmesg = 'He slashes at you'
def test_inits(self): char = C.Character('Grognak') # YOU MADE A CHARACTER self.assertIsInstance(char,C.Character) # You made a hero hero = H.Hero('Grognak', [20, 20]) self.assertIsInstance(hero, H.Hero) # You made a monster monster = M.Monster('Goblin', 5, 5, 1) self.assertIsInstance(monster,M.Monster)
def choose_battle(player, MONSTERS_DICT, BATTLE_DESCRIPTS): if not MONSTERS_DICT: return None # random_num = random.randint(0, (len(MONSTERS_DICT)-1)) chosen_monster = MONSTERS_DICT[0] # random_monster = MONSTERS_DICT[random_num] random.shuffle(BATTLE_DESCRIPTS) chosen_descript = BATTLE_DESCRIPTS[0] battle_event = Battle(chosen_descript, player=player, monster=Monster(name=chosen_monster["name"], hp=chosen_monster["hp"], dmg=chosen_monster["damage"], exp=chosen_monster["exp"], gold=chosen_monster["gold"]), exp=chosen_monster["exp"], gold=chosen_monster["gold"]) return battle_event
def test_hero_methods(self): # check that the set_starter_stats consistently sets the stats hero1 = H.Hero('Grognak', [1, 1]) hero1.set_starter_stats() self.assertTrue(hero1.current_hp,10) self.assertTrue(hero1.max_hp, 10) self.assertTrue(hero1.armor, 1) self.assertTrue(hero1.strength, 3) # Check that leveling works hero1.gain_xp(101) self.assertEqual(hero1.xp, 101) self.assertEqual(hero1.level, 2) # Check that set_opened_save_stats does the same hero1.set_opened_save_stats(8, 16, 3, 4, 150, 2, 1, 200, 23, 24) self.assertEqual(hero1.current_hp,8) self.assertEqual(hero1.max_hp, 16) self.assertEqual(hero1.armor, 3) self.assertEqual(hero1.strength, 4) self.assertEqual(hero1.xp, 150) self.assertEqual(hero1.level, 2) self.assertEqual(hero1.money, 1) self.assertEqual(hero1.next_level, 200) self.assertEqual(hero1.hero_pos, [23, 24]) # check for hp gains hero1.gain_hp_from_rest(True) self.assertEqual(hero1.current_hp, 12) # check that not only does this heal, but not more than it should hero1.gain_hp_from_rest(False) self.assertEqual(hero1.current_hp, 14) # make sure 'overhealing' isnt possible hero1.gain_hp_from_rest(True) self.assertEqual(hero1.current_hp, 16) monster = M.Monster('Goblin', 5, 5, 1) monster.attack_enemy(hero1) # The goblin is too weak to harm the hero. self.assertEqual(hero1.current_hp,16) # The reverse is not true however hero1.attack_enemy(monster) self.assertLess(monster.current_hp, 1)
def insert_monster_loop(): print('Here we insert a monster') name = input('Please Give Monster Name') while True: try: max_hp = int(input('What is the monsters Max HP? Minimum of 1.')) if max_hp < 1: print('That was not greater than 0') else: break except ValueError: print('Sorry that was not an Integer.') while True: try: strength = int( input('what is this monsters strength? Minimum is 1.')) if strength < 1: print('Sorry that was not 1 or greater.') else: break except ValueError: print('Sorry, that wasn\'t a Integer.') while True: try: armor = int(input('What is the monsters Armor? Minimum of 0.')) if armor < 0: print(' That was an invalid number, positive numbers only.') else: break except ValueError: print('Sorry that was not an Integer.') while True: try: xp_val = int(input('What is the monsters XP Value? Minimum of 1.')) if xp_val < 0: print( ' That was an invalid number, positive numbers only, greater than 0.' ) else: break except ValueError: print('That is not an integer.') while True: try: money = int( input('How much Money does the monster have? Minimum of 0.')) if money < 0: print(' That was an invalid number, positive numbers only.') else: break except ValueError: print('Sorry that was not an Integer.') while True: try: level = int(input('What is the monsters level? Minimum of 1.')) if level < 0: print(' That was an invalid number, positive numbers only.') else: break except ValueError: print('Sorry that was not an Integer.') # Now that all that data has been collected we toss it into the Peewee model, and send it to the DB new_monster = Monster(name, xp_val, money, level) new_monster.set_str_and_armor(strength, armor, max_hp) DM.add_monster(new_monster)