Story¶
- class afc.story.scene.scene.Scene(parent=None, children=_Nothing.NOTHING, locals=_Nothing.NOTHING, text='', render_handler=_Nothing.NOTHING, runtime_handler=_Nothing.NOTHING, conditions=None, effects=None, index=_Nothing.NOTHING, my_var=0, is_entry=False, *, guid=_Nothing.NOTHING, uid=None)¶
The Scene class extends the Node class and represents a scene in a narrative structure.
A scene is a root node for a specific narrative arc and it can contain multiple Blocks and Roles. It provides methods to add a block or role and also to get its namespace.
- Variables:
blocks – A list of blocks that belong to this scene.
roles – A list of roles that belong to this scene.
is_entry – indicates the entry point for the story
- enter()¶
Apply the effects and return a pointer to the current node.
- is_enterable()¶
Returns True if the block’s conditions are satisfied, else False.
- class afc.story.scene.block.Block(parent=None, children=_Nothing.NOTHING, locals=_Nothing.NOTHING, trade_handler=_Nothing.NOTHING, owned_objects=_Nothing.NOTHING, text='', render_handler=_Nothing.NOTHING, runtime_handler=_Nothing.NOTHING, conditions=None, effects=None, index=_Nothing.NOTHING, my_var=0, is_entry=False, *, guid=_Nothing.NOTHING, uid=None)¶
The Block class extends the Node class and represents a passage or narrative beat within a scene. It can contain multiple Actions and certain actions may be triggered automatically on enter or exit.
- Variables:
text – The text of the block.
actions – A list of actions that belong to this block.
- property actions¶
Returns a dictionary of child Action objects.
- enter()¶
Apply the effects and return a pointer to the current node.
- exit()¶
Should return the next node, which is dependent on the current node class.
- class afc.story.scene.challenge.Challenge(parent=None, children=_Nothing.NOTHING, locals=_Nothing.NOTHING, trade_handler=_Nothing.NOTHING, owned_objects=_Nothing.NOTHING, text='', render_handler=_Nothing.NOTHING, runtime_handler=_Nothing.NOTHING, conditions=None, effects=None, index=_Nothing.NOTHING, my_var=0, is_entry=False, game_handler=None, *, guid=_Nothing.NOTHING, uid=None)¶
A block representing a win/lose scenario, wrapped around a GameHandler.
- get_possible_choices()¶
Delegate to the GameHandler to get the possible actions.
- handle_choice(choice)¶
Delegate to the GameHandler to handle the action and update the game state.
- class afc.story.scene.action.Action(parent=None, children=_Nothing.NOTHING, locals=_Nothing.NOTHING, text='', render_handler=_Nothing.NOTHING, runtime_handler=_Nothing.NOTHING, conditions=None, effects=None, index=_Nothing.NOTHING, my_var=0, target_block_id=None, auto_trigger=None, *, guid=_Nothing.NOTHING, uid=None)¶
- enter(**kwargs)¶
Apply the effects and return a pointer to the current node.
- is_enterable()¶
Returns True if the block’s conditions are satisfied, else False.