Modules#
Modules
This code provides the random Modules (Monster, NPC, etc).
- class lambdaHandlers.modules.Encounter(cr, environment)#
Encounter Class
- get_long_description()#
Build the long description
>>> import random >>> random.seed(13) >>> encounter = Encounter("19", "") >>> encounter.get_long_description() 'NPC: \n\tUthemar - warlord\nMonster 1:\n\tankheg - HP: 86-100\n'
- get_short_description()#
Build the short description
>>> import random >>> random.seed(13) >>> encounter = Encounter("19", "") >>> encounter.get_short_description() 'warlord and ankheg'
- class lambdaHandlers.modules.Error(message)#
Error Class
- get_long_description()#
Build the long description
>>> # dummy error Module
>>> error = Error("ERROR: message goes here") >>> error.get_long_description() 'ERROR: message goes here'
- get_short_description()#
Build the short description
>>> # dummy error Module
>>> error = Error("ERROR: message goes here") >>> error.get_short_description() 'ERROR: message goes here'
- class lambdaHandlers.modules.Module#
Module base class
- abstract get_long_description()#
Build the long description
- abstract get_short_description()#
Build the short description
- class lambdaHandlers.modules.Monster(cr, environment)#
Monster Class
- get_long_description()#
Build the long description
>>> import random >>> random.seed(13) >>> # valid monster found >>> monster = Monster("2", "") >>> monster.get_long_description() 'gargoyle - HP: 86-100' >>> # no monster found >>> monster = Monster("31", "") ERROR: No suitable monster found >>> monster.get_long_description() 'ERROR: No suitable monster found'
- get_random_monster(cr, environment)#
Get a random monster by CR and environment
- get_short_description()#
Build the short description
>>> import random >>> random.seed(13) >>> # valid monster found >>> monster = Monster("2", "") >>> monster.get_short_description() 'gargoyle' >>> # no monster found >>> monster = Monster("31", "") ERROR: No suitable monster found >>> monster.get_short_description() 'ERROR: No suitable monster found'
- class lambdaHandlers.modules.Npc(cr, environment)#
Npc Class
- get_long_description()#
Build the long description
>>> import random >>> random.seed(13) >>> # valid NPC found >>> npc = Npc("9", "") >>> npc.get_long_description() 'Uthemar - abjurer' >>> # no NPC found >>> npc = Npc("15", "mountain") ERROR: No suitable NPC found >>> npc.get_long_description() 'ERROR: No suitable NPC found'
- get_random_npc_type(cr, environment)#
Get a random NPC type by CR and environment
- get_short_description()#
Build the short description
>>> import random >>> random.seed(13) >>> # valid NPC found >>> npc = Npc("9", "") >>> npc.get_short_description() 'abjurer' >>> # no NPC found >>> npc = Npc("15", "mountain") ERROR: No suitable NPC found >>> npc.get_short_description() 'ERROR: No suitable NPC found'
- class lambdaHandlers.modules.PlotArc(cr, environment)#
PlotArc Class
- get_long_description()#
Build the long description
>>> import random >>> random.seed(13) >>> # valid plot arc built >>> arc = PlotArc("9", "") >>> arc.get_long_description() 'Arnbjorg - abjurer, is trying to place a pawn in a position of power' >>> # no plot arc built >>> arc = PlotArc("15", "underdark") ERROR: No suitable NPC found >>> arc.get_short_description() 'ERROR: No suitable plot arc built'
- get_short_description()#
Build the short description
>>> import random >>> random.seed(13) >>> # valid plot arc build >>> arc = PlotArc("9", "") >>> arc.get_short_description() 'abjurer is trying to place a pawn in a position of power' >>> # no plot arc built >>> arc = PlotArc("15", "underdark") ERROR: No suitable NPC found >>> arc.get_short_description() 'ERROR: No suitable plot arc built'
- lambdaHandlers.modules.get_module_args_from_intent_name(intent_name)#
Parses intent name into requested features
>>> get_module_args_from_intent_name("MonsterByCRandEnvironment") {'has_cr': True, 'has_environment': True, 'module_type': 'Monster'} >>> get_module_args_from_intent_name("NpcByCR") {'has_cr': True, 'has_environment': False, 'module_type': 'Npc'} >>> get_module_args_from_intent_name("EncounterByCRandEnvironment") {'has_cr': True, 'has_environment': True, 'module_type': 'Encounter'} >>> get_module_args_from_intent_name("PlotArcByEnvironment") {'has_cr': False, 'has_environment': True, 'module_type': 'Plot Arc'} >>> get_module_args_from_intent_name("TypoByEnvironment") {'has_cr': False, 'has_environment': True, 'module_type': 'ERROR'}
- lambdaHandlers.modules.module_from_intent(intent)#
Parses intent object to create module
>>> import random >>> random.seed(13) >>> # valid monster intent >>> monster_intent = { ... 'name': "MonsterByCRandEnvironment", ... 'slots': { ... 'cr': {'value': "2"}, ... 'env': {'value': "swamp"} ... } ... } >>> module_from_intent(monster_intent) swarm of poisonous snakes >>> # invalid npc intent >>> npc_intent = { ... 'name': "NPCByEnvironment", ... 'slots': { ... 'cr': {'value': "2"} ... } ... } >>> module_from_intent(npc_intent) ERROR: No environment found >>> # invalid plot arc intent >>> npc_intent = { ... 'name': "PlotArcByCR", ... 'slots': { ... 'environment': {'value': "swamp"} ... } ... } >>> module_from_intent(npc_intent) ERROR: No CR found >>> # invalid module type intent >>> error_intent = { ... 'name': "TypoByCR", ... 'slots': { ... 'cr': {'value': "2"} ... } ... } >>> module_from_intent(error_intent) ERROR: No suitable module found