def test_taking_off_boots(self): """ Boots can be removed """ character = CharacterBuilder().build() boots = (ItemBuilder().with_name('boots').with_boots_speed_modifier( 1).build()) character.inventory.boots = boots unequip(character, boots) assert_that(character, is_not(is_wearing_boots(boots)))
def test_taking_off_boots(self): """ Boots can be removed """ character = CharacterBuilder().build() boots = (ItemBuilder() .with_name('boots') .with_boots_speed_modifier(1) .build()) character.inventory.boots = boots unequip(character, boots) assert_that(character, is_not(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 unequip_item(self, item): """ Unequip item """ unequip(self.character, item)