def test_unproficient_armor(self): attacker = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) target = Goblin() attacker.set_armor(armors[ArmorId.PLATE]) set_values([20, 3]) with patch('game_engine.dice._random_int', side_effect=value): self.assertEqual(roll_to_hit(attacker, target, weapons[WeaponId.DAGGER], None), HitType.MISS)
def test_proficieny_matters_not_rogue(self): # makes sure to use the higher mod to be able to hit # goblin AC is 15 # rolls a 13 attacker = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) target = Goblin() attack = weapons[WeaponId.MAUL] set_values([13]) with patch('game_engine.dice._random_int', side_effect=value): self.assertEqual(roll_to_hit(attacker, target, attack, None), HitType.MISS)
def available_classes(): return [Fighter(), Rogue()]
def test_replace(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) player.set_right_hand(weapons[WeaponId.RAPIER]) player.set_left_hand(armors[ArmorId.SHIELD]) player.set_left_hand(weapons[WeaponId.DAGGER]) self.assertEqual(WeaponId.DAGGER, player.get_left_hand().get_id())
def test_left_shield(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) player.set_left_hand(armors[ArmorId.SHIELD]) self.assertEqual(ArmorType.SHIELD, player.get_shield().get_type())
def test_no_shield(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) self.assertIsNone(player.get_shield())
def test_not_proficient_armor_none(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) player.set_armor(armors[ArmorId.PLATE]) self.assertTrue(player.wearing_unproficient_armor())
def test_proficient_armor(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) player.set_armor(armors[ArmorId.LEATHER]) self.assertFalse(player.wearing_unproficient_armor())
def test_proficient_armor_none(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) self.assertFalse(player.wearing_unproficient_armor())
def test_shield_proficiency(self): f = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) self.assertFalse(f.is_armor_proficient(armors[ArmorId.SHIELD]))
def test_armor_proficiency_plate(self): f = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) self.assertTrue(f.is_armor_proficient(armors[ArmorId.LEATHER]))
def test_weapon_proficiency_maul(self): f = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) self.assertFalse(f.is_weapon_proficient(weapons[WeaponId.MAUL]))
def test_weapon_proficiency_heavy_crossbow(self): f = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) self.assertFalse(f.is_weapon_proficient(weapons[WeaponId.HEAVY_CROSSBOW]))
def test_weapon_proficiency_club(self): f = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) self.assertTrue(f.is_weapon_proficient(weapons[WeaponId.CLUB]))
def test_weapon_proficiency_longsword(self): f = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Rogue()) self.assertTrue(f.is_weapon_proficient(weapons[WeaponId.LONGSWORD]))