Beispiel #1
0
    def test_get_weapon_damage_returns_correct_damage(self):
        sword = weapon.Weapon("ashbringer", [dice.Dice(12, 12)])
        self.base_inventory.add_equipment(sword)

        damage = self.base_inventory.weapon_damage()

        self.assertEqual(12, damage)
Beispiel #2
0
    def test_add_equipment_replaces_correct_slot(self):
        sword = weapon.Weapon("ashbringer", [dice.Dice(12, 12)])
        self.base_inventory.add_equipment(sword)

        self.assertIsNotNone(
            self.base_inventory.equipment[equipmentslot.EquipmentSlot.HANDS])
        self.assertIsNone(
            self.base_inventory.equipment[equipmentslot.EquipmentSlot.CHEST])
Beispiel #3
0
    def test_remove_equipment_removes_correct_slot(self):
        sword = weapon.Weapon("ashbringer", [dice.Dice(12, 12)])
        shirt = armor.Armor("shirt", 2)
        self.base_inventory.add_equipment(sword)
        self.base_inventory.add_equipment(shirt)

        self.base_inventory.remove_equipment(equipmentslot.EquipmentSlot.CHEST)

        self.assertIsNotNone(
            self.base_inventory.equipment[equipmentslot.EquipmentSlot.HANDS])
        self.assertIsNone(
            self.base_inventory.equipment[equipmentslot.EquipmentSlot.CHEST])
    def test_weapon_two_dice_damage_equals_sum(self):
        damage_dice = [self.dice_six, self.dice_three]
        sword = weapon.Weapon("sword", damage_dice)
        damage = sword.damage()

        self.assertEqual(9, damage)
    def test_weapon_one_dice_damage_equals_dice(self):
        damage_dice = [self.dice_six]
        sword = weapon.Weapon("sword", damage_dice)
        damage = sword.damage()

        self.assertEqual(6, damage)
 def test_attack_gives_weapon_damage(self):
     sword = weapon.Weapon("ashbringer", [dice.Dice(10, 10)])
     self.ally.add_equipment(sword)
     self.ally.attack(self.enemy)
     self.assertEqual(2, self.enemy.hp)