<s> """<STR_LIT>""" <EOL> from pyherc . aspects import log_debug , log_info <EOL> from pyherc . rules . factory import SubActionFactory <EOL> from pyherc . rules . magic . action import GainDomainAction , SpellCastingAction <EOL> class SpellCastingFactory ( SubActionFactory ) : <EOL> """<STR_LIT>""" <EOL> @ log_debug <EOL> def __init__ ( self , spell_factory , effects_factory , dying_rules ) : <EOL> """<STR_LIT>""" <EOL> super ( ) . __init__ ( ) <EOL> self . spell_factory = spell_factory <EOL> self . effects_factory = effects_factory <EOL> self . dying_rules = dying_rules <EOL> self . action_type = '<STR_LIT>' <EOL> @ log_info <EOL> def get_action ( self , parameters ) : <EOL> """<STR_LIT>""" <EOL> spell = self . spell_factory . create_spell ( <EOL> spell_name = parameters . spell_name , <EOL> targets = self . _get_spell_targets ( parameters ) ) <EOL> return SpellCastingAction ( caster = parameters . caster , <EOL> spell = spell , <EOL> effects_factory = self . effects_factory , <EOL> dying_rules = self . dying_rules ) <EOL> @ log_debug <EOL> def _get_spell_targets ( self , parameters ) : <EOL> """<STR_LIT>""" <EOL> spec = self . spell_factory . spell_list [ parameters . spell_name ] <EOL> return spec . targeter ( parameters ) <EOL> class GainDomainFactory ( SubActionFactory ) : <EOL> """<STR_LIT>""" <EOL> @ log_debug <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( ) . __init__ ( ) <EOL> self . action_type = '<STR_LIT>' <EOL> @ log_info <EOL> def get_action ( self , parameters ) : <EOL> """<STR_LIT>""" <EOL> return GainDomainAction ( character = parameters . character , <EOL> item = parameters . item , <EOL> domain = parameters . domain ) </s>
