示例#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)
示例#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)
示例#3
0
 def available_classes():
     return [Fighter(), Rogue()]
示例#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())
示例#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())
示例#6
0
 def test_no_shield(self):
     player = Player('bob', [10, 10, 10, 10, 10, 10], Human(), Rogue())
     self.assertIsNone(player.get_shield())
示例#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())
示例#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())
示例#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())
示例#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]))
示例#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]))
示例#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]))
示例#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]))
示例#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]))
示例#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]))