コード例 #1
0
 def test_default_human_creation(self):
     creature = Factory().create_creature(creature_class="human", first_name="John", second_name="Doe")
     stats = creature.stats()
     expected_values = (10, 10, 10, 10, 0, 0, 0, 0, False)
     actual_values = (
         stats.constitution(), stats.physicality_base(), stats.dexterity_base(), stats.social(), stats.experience(),
         stats.magic_base(), stats.gold_worth(), stats.experience_worth(), stats.magic_enabled()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #2
0
 def test_use_action_base_damage_using_social(self):
     harsh_language_skill = HarshLanguage(base_value=0,
                                          dice_quantity=0,
                                          dice_max=0)
     creature1 = Factory().create_creature(creature_class="goblin",
                                           first_name="John",
                                           second_name="Doe",
                                           stat_values={"social": 5})
     creature2 = Factory().create_creature(creature_class="goblin",
                                           first_name="Charles",
                                           second_name="Brown")
     action = harsh_language_skill.use(creature1, creature2)
     self.assertEqual(5, action.damage())
コード例 #3
0
 def test_create_creature_with_stat_values(self):
     stat_values = {
         "constitution": 1, "physicality": 2, "dexterity": 3, "social": 4, "experience": 5, "magic_base": 6,
         "gold_worth": 7, "experience_worth": 8, "magic_enabled": True
     }
     creature = Factory().create_creature(
         creature_class="goblin", first_name="John", second_name="Doe", stat_values=stat_values
     )
     stats = creature.stats()
     expected_values = (1, 2, 3, 4, 5, 6, 7, 8, True)
     actual_values = (
         stats.constitution(), stats.physicality_base(), stats.dexterity_base(), stats.social(), stats.experience(),
         stats.magic_base(), stats.gold_worth(), stats.experience_worth(), stats.magic_enabled()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #4
0
 def test_create_weapon_default_sword(self):
     weapon = Factory().create_weapon("sword")
     expected_values = (0, 1, 6, 5, 4, "Sword")
     actual_values = (
         weapon.base_value(), weapon.dice_quantity(), weapon.dice_max(), weapon.value(), weapon.weight(),
         weapon.name()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #5
0
 def test_create_weapon_default_unarmed(self):
     weapon = Factory().create_weapon("unarmed")
     expected_values = (0, 1, 1, 0, 0, "Fist")
     actual_values = (
         weapon.base_value(), weapon.dice_quantity(), weapon.dice_max(), weapon.value(), weapon.weight(),
         weapon.name()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #6
0
 def test_create_weapon_default_dagger(self):
     weapon = Factory().create_weapon("dagger")
     expected_values = (0, 1, 3, 2, 1, "Dagger")
     actual_values = (
         weapon.base_value(), weapon.dice_quantity(), weapon.dice_max(), weapon.value(), weapon.weight(),
         weapon.name()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #7
0
 def test_create_weapon_default_rock_fist(self):
     weapon = Factory().create_weapon("rock_fist")
     expected_values = (3, 1, 8, 0, 0, "Rock Fist")
     actual_values = (
         weapon.base_value(), weapon.dice_quantity(), weapon.dice_max(), weapon.value(), weapon.weight(),
         weapon.name()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #8
0
 def test_is_usable_magic_not_enabled_and_invalid_mana(self):
     spell = Spell(cost=1)
     creature = Factory().create_creature(creature_class="goblin",
                                          first_name="John",
                                          second_name="Doe",
                                          stat_values={
                                              "magic_enabled": False,
                                              "magic_base": -10
                                          })
     self.assertEqual(False, spell.is_usable(creature))
コード例 #9
0
 def test_create_weapon_with_stat_values(self):
     stat_values = {"base_value": 1, "dice_quantity": 2, "dice_max": 3, "value": 4, "weight": 5}
     weapon = Factory().create_weapon(weapon_class="sword", stat_values=stat_values)
     expected_values = (1, 2, 3, 4, 5, "Sword")
     actual_values = (
         weapon.base_value(), weapon.dice_quantity(), weapon.dice_max(), weapon.value(), weapon.weight(),
         weapon.name()
     )
     self.assertTupleEqual(expected_values, actual_values)
コード例 #10
0
ファイル: tests.py プロジェクト: YeetmeisterII/mediah
 def test_use_greater_healing_potion_healing_quantity(self):
     healing_potion = GreaterHealingPotion()
     executor = Factory().create_creature(creature_class="goblin", first_name="John", second_name="Doe")
     target = Factory().create_creature(creature_class="goblin", first_name="Charles", second_name="Brown")
     action = healing_potion.use(executor=executor, target=target)
     self.assertEqual(30, action.healing_quantity())
コード例 #11
0
ファイル: tests.py プロジェクト: YeetmeisterII/mediah
 def test_use_remaining_uses_reduction(self):
     healing_potion = LesserHealingPotion()
     executor = Factory().create_creature(creature_class="goblin", first_name="John", second_name="Doe")
     target = Factory().create_creature(creature_class="goblin", first_name="Charles", second_name="Brown")
     healing_potion.use(executor=executor, target=target)
     self.assertEqual(0, healing_potion.remaining_uses())
コード例 #12
0
 def test_create_weapon(self):
     weapon = Factory().create_weapon("sword")
     self.assertEqual(Sword, type(weapon))
コード例 #13
0
 def test_create_weapon_without_name(self):
     weapon = Factory().create_weapon(weapon_class="sword")
     self.assertEqual("Sword", weapon.name())
コード例 #14
0
 def test_create_weapon_default_harsh_language(self):
     skill = Factory().create_weapon("harsh_language")
     expected_values = (0, 1, 4, "Harsh Language")
     actual_values = (skill.base_value(), skill.dice_quantity(), skill.dice_max(), skill.name())
     self.assertTupleEqual(expected_values, actual_values)
コード例 #15
0
 def test_create_weapon_default_fire_breath(self):
     skill = Factory().create_weapon("fire_breath")
     expected_values = (0, 2, 12, "Fire Breath")
     actual_values = (skill.base_value(), skill.dice_quantity(), skill.dice_max(), skill.name())
     self.assertTupleEqual(expected_values, actual_values)
コード例 #16
0
 def test_create_creature(self):
     creature = Factory().create_creature(creature_class="goblin", first_name="John", second_name="Doe")
     self.assertEqual(Goblin, type(creature))
コード例 #17
0
 def test_create_weapon_with_name(self):
     weapon = Factory().create_weapon(weapon_class="sword", name="John Doe")
     self.assertEqual("John Doe (Sword)", weapon.name())