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_goblin_attack_player(self): attacker = Goblin() target = Player('Bob', [10, 10, 10, 10, 10, 10], Human(), Fighter()) target.set_armor(armors[ArmorId.CHAIN_SHIRT]) target.set_left_hand(armors[ArmorId.SHIELD]) set_values([11]) with patch('game_engine.dice._random_int', side_effect=value): self.assertEqual(roll_to_hit(attacker, target, attacker.get_actions()[0], None), HitType.HIT)
def test_fs_defence_armor(self): attacker = Player('Bob', [10, 10, 17, 17, 17, 17], Human(), Fighter()) target = Player('Other Bob', [10, 10, 17, 17, 17, 17], Human(), Fighter()) target.add_fighting_style(Trait.FIGHTING_STYLE_DEFENCE) target.set_armor(armors[ArmorId.LEATHER]) set_values([9]) with patch('game_engine.dice._random_int', side_effect=value): self.assertEqual(HitType.MISS, roll_to_hit(attacker, target, weapons[WeaponId.DAGGER], None))
def test_too_weak_has_str(self): player = Player('Radrick', [13, 18, 10, 10, 10, 10], Human(), Fighter()) player.set_armor(armors[ArmorId.CHAIN_MAIL]) self.assertFalse(player.too_weak_for_armor())
def test_too_weak_no_requirement(self): player = Player('Radrick', [10, 18, 10, 10, 10, 10], Human(), Fighter()) player.set_armor(armors[ArmorId.LEATHER]) self.assertFalse(player.too_weak_for_armor())
def test_medium_armor_dex(self): player = Player('Radrick', [10, 18, 10, 10, 10, 10], Human(), Fighter()) player.set_armor(armors[ArmorId.HIDE]) self.assertEqual(14, player.get_ac())
def test_ac_heavy_high_dex(self): player = Player('Radrick', [10, 18, 10, 10, 10, 10], Human(), Fighter()) player.set_right_hand(armors[ArmorId.SHIELD]) player.set_armor(armors[ArmorId.PLATE]) self.assertEqual(20, player.get_ac())
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_encumbered_speed(self): player = Player('Radrick', [10, 18, 10, 10, 10, 10], Human(), Fighter()) player.set_armor(armors[ArmorId.CHAIN_MAIL]) self.assertEqual(20, player.get_speed())