def test_Damage(self): play = Player('Greg') bp = play.backpack bp.weapons.append(Weapon('sword', 20, lambda: Dice.eight_sided(), True)) dam = play.get_damage_inflicted() print(str.format("Damage: {}", dam)) self.assertTrue(1 <= dam <= 8)
def get_initial_hit_points(self): bonus = pu.BONUS_PENALTIES[self.attributes.constitution] bonus = bonus if bonus > 0 else 0 return Dice.eight_sided() + bonus
def make_goblin(gname: str) -> Monster: monster = Monster(name=gname, damage=lambda: Dice.eight_sided(), armour=6, xpvalue=1) monster.init_hp(6) monster.wallet = Wallet(gold=Dice.eight_sided()) return monster
def test_weapon(self): weapon = Weapon('sword', 20, lambda: Dice.eight_sided()) print(str.format('Attack1 = {0}', weapon.get_damage())) print(str.format('Attack2 = {0}', weapon.get_damage())) self.assertIsNotNone(weapon)