#!/usr/bin/python3 """ This module implements the GameActor class """ class GameActor(GameObject): """ A GameActor (typically a PC or NPC) is an agent that has a context and is capable of initiating and receiving actions. """ def __init__(self, name="actor", descr=None): """ create a new GameActor @param name: display name of this actor @param descr: human description of this actor """ def accept_action(self, action, actor, context): """ receive and process the effects of an ATTACK (other actions are passed to our super-class) A standard attack comes with at-least two standard attributes: - TO_HIT ... the (pre defense) to-hit probability - HIT_POINTS ... the (pre-armor) damage being delivered 1. use D100+EVASION to determine if attack hits 2. use PROTECTION to see how much damage gets through 3. update LIFE_POINTS @param action: (GameAction) being performed @param actor: (GameActor) initiating the action @param context: (GameContext) in which action is being taken @return: (boolean, string) description of the effect """ def interact(self, actor): """ return a list of possible interactions (w/this GameActor) @param actor: (GameActor) initiating the interactions @return: Interaction object GameObjects have a (ACTIONS) list of verbs that can be turned into a list of the GameActions that they enable. GameActors have a (INTERACTIONS) list of verbs that a requesting GameActor can turn into interaction GameActions that can be exchanged with that character. The interaction object will have an ACTIONS attribute, containing a comma-separated list of the supported interaction verbs (which can be used to instantiate and deliver GameActions). """ def set_context(self, context): """ establish the local context """ def take_action(self, action, target): """ Initiate an action against a target @param action: (GameAction) to be initiated @param target: (GameObject) target of the action @return: (boolean, string) result of the action """ def take_turn(self): """ called once per round in initiative order (must be implemented in sub-classes) """