def test_wear_boots(self): """ Test that boots can be worn """ character = CharacterBuilder().build() boots = (ItemBuilder().with_name('boots').with_boots_speed_modifier( 1).build()) equip(character, boots) assert_that(character, is_wearing_boots(boots))
def test_wear_armour(self): """ Test that armour can be worn """ character = CharacterBuilder().build() armour = (ItemBuilder().with_damage_reduction(2).with_speed_modifier( 1).with_name('leather armour').build()) equip(character, armour) assert_that(character, is_wearing_armour(armour))
def test_wear_boots(self): """ Test that boots can be worn """ character = CharacterBuilder().build() boots = (ItemBuilder() .with_name('boots') .with_boots_speed_modifier(1) .build()) equip(character, boots) assert_that(character, is_wearing_boots(boots))
def use_item(self, item): """ Use item in different ways, depending on the item """ if is_potion(item) and is_drinking_legal(self.character, item): drink(self.character, item) elif is_weapon(item): if self.character.inventory.weapon is not None: unequip(self.character, self.character.inventory.weapon) equip(self.character, item) elif is_armour(item): if self.character.inventory.armour is not None: unequip(self.character, self.character.inventory.armour) equip(self.character, item) elif is_boots(item): if self.character.inventory.boots is not None: unequip(self.character, self.character.inventory.boots) equip(self.character, item) elif is_ammunition(item): equip(self.character, item) elif is_trap_bag(item): place_trap(self.character, item)
def test_wear_armour(self): """ Test that armour can be worn """ character = CharacterBuilder().build() armour = (ItemBuilder() .with_damage_reduction(2) .with_speed_modifier(1) .with_name('leather armour') .build()) equip(character, armour) assert_that(character, is_wearing_armour(armour))