Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def available_classes():
     return [Fighter(), Rogue()]
Example #4
0
 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())
Example #5
0
 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())
Example #6
0
 def test_no_shield(self):
     player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue())
     self.assertIsNone(player.get_shield())
Example #7
0
 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())
Example #8
0
 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())
Example #9
0
 def test_proficient_armor_none(self):
     player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue())
     self.assertFalse(player.wearing_unproficient_armor())
Example #10
0
 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]))
Example #11
0
 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]))
Example #12
0
 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]))
Example #13
0
 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]))
Example #14
0
 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]))
Example #15
0
 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]))