def test_using_versatile_one_handed(self): attacker = Player('Bob', [10, 10, 10, 10, 10, 10], Human(), Fighter()) attacker.set_right_hand(weapons[WeaponId.SPEAR]) d = roll_damage(attacker, None, attacker.get_right_hand(), HitType.HIT, None) # kind of lame, not always going to fail, not sure how else to be sure # TODO: could be solved by a debugging option to focus dice to roll max then check for 6 self.assertTrue(1 <= d <= 6)
def test_fs_dueling_shield(self): attacker = Player('Bob', [10, 10, 10, 10, 10, 10], Human(), Fighter()) attacker.set_right_hand(weapons[WeaponId.SPEAR]) attacker.set_left_hand(armors[ArmorId.SHIELD]) attacker.add_fighting_style(Trait.FIGHTING_STYLE_DUELING) set_values([6]) with patch('game_engine.dice._random_int', side_effect=value): self.assertEqual( 8, roll_damage(attacker, None, attacker.get_right_hand(), HitType.HIT, None))
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_ac_naked_shield(self): player = Player('Radrick', [10, 10, 10, 10, 10, 10], Human(), Fighter()) player.set_right_hand(armors[ArmorId.SHIELD]) self.assertEqual(player.get_ac(), 12)
def test_spear_one_hand(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Fighter()) player.set_right_hand(weapons[WeaponId.SPEAR]) self.assertEqual(WeaponId.SPEAR, player.get_right_hand().get_id())
def test_two_hands(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Fighter()) player.set_right_hand(armors[ArmorId.SHIELD]) player.set_two_hands(weapons[WeaponId.MAUL]) self.assertIsNone(player.get_right_hand()) self.assertEqual(WeaponId.MAUL, player.get_two_hands().get_id())
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_right_shield(self): player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue()) player.set_right_hand(armors[ArmorId.SHIELD]) self.assertEqual(ArmorType.SHIELD, player.get_shield().get_type())