<s> """<STR_LIT>""" <EOL> from pyherc . data import is_armour , is_weapon , is_boots <EOL> from pyherc . aspects import log_debug , log_info <EOL> from pyherc . events import new_unequip_event <EOL> from pyherc . rules . factory import SubActionFactory <EOL> class UnEquipFactory ( SubActionFactory ) : <EOL> """<STR_LIT>""" <EOL> @ log_debug <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( ) . __init__ ( ) <EOL> self . sub_action = '<STR_LIT>' <EOL> @ log_debug <EOL> def can_handle ( self , parameters ) : <EOL> """<STR_LIT>""" <EOL> return self . sub_action == parameters . sub_action <EOL> @ log_info <EOL> def get_action ( self , parameters ) : <EOL> """<STR_LIT>""" <EOL> return UnEquipAction ( parameters . character , parameters . item ) <EOL> class UnEquipAction ( ) : <EOL> """<STR_LIT>""" <EOL> @ log_debug <EOL> def __init__ ( self , character , item ) : <EOL> """<STR_LIT>""" <EOL> super ( ) . __init__ ( ) <EOL> self . character = character <EOL> self . item = item <EOL> @ log_info <EOL> def execute ( self ) : <EOL> """<STR_LIT>""" <EOL> if is_armour ( self . item ) : <EOL> self . character . inventory . armour = None <EOL> self . character . raise_event ( new_unequip_event ( self . character , <EOL> self . item ) ) <EOL> if is_weapon ( self . item ) : <EOL> self . character . inventory . weapon = None <EOL> self . character . raise_event ( new_unequip_event ( self . character , <EOL> self . item ) ) <EOL> if is_boots ( self . item ) : <EOL> self . character . inventory . boots = None <EOL> self . character . raise_event ( new_unequip_event ( self . character , <EOL> self . item ) ) <EOL> @ log_debug <EOL> def is_legal ( self ) : <EOL> """<STR_LIT>""" <EOL> return True </s>
