Class StoryPoint

java.lang.Object
mekhq.campaign.storyArc.StoryPoint
Direct Known Subclasses:
CheckDateReachedStoryPoint, CheckMoreScenariosStoryPoint, CheckPersonStatusStoryPoint, CheckStringVariableStoryPoint, CreateCharacterStoryPoint, DialogStoryPoint, MissionStoryPoint, PersonStatusStoryPoint, RollDiceStoryPoint, ScenarioStoryPoint, TravelStoryPoint, WaitStoryPoint

public abstract class StoryPoint extends Object

The StoryPoint abstract class is the basic building block of a StoryArc. StoryPoints can do different things when they are started. When they are completed they may start other story points as determined by the specific class and user input. StoryPoints are started in one of the following ways: (1) by being selected as the next story point by a prior StoryPoint; (2) by meeting the trigger conditions that StoryArc listens for.

When a StoryPoint is started, it runs the start method. This method will often be overridden by extending classes, but overriding methods should include `super.start()` at the beginning.

When a StoryPoint is done, it runs the complete method. This method will also often be overwritten by extending classes, but such methods should include `super.complete()` at the end to ensure StoryTriggers and StoryOutcomes are processed.

A StoryPoint should always return a String with the getResult method. This abstract method must be supplied in all concrete classes. It can be used to indicate different possible outcomes from the StoryPoint.

A StoryPoint can contain a hash of StoryOutcome objects. The key for the hash is a particular result from the getResult method. When a story point is completed, a StoryOutcome matching the result will be looked for. If one is found, its `nextStoryPointId` and StoryTriggers will replace the default ones set in this class. This feature is what allows for branching.

A StoryPoint can also contain a list of StoryTrigger objects. StoryTriggers can be used to make various changes to the campaign. These StoryTriggers will be processed upon the completion of the StoryPoint. Note that if a StoryOutcome is found that matches the getResult method, the default StoryTriggers specified will be replaced by those from the StoryOutcome.

  • Field Details

  • Constructor Details

    • StoryPoint

      public StoryPoint()
  • Method Details

    • setStoryArc

      public void setStoryArc(StoryArc a)
    • getStoryArc

      protected StoryArc getStoryArc()
    • setId

      public void setId(UUID id)
    • getId

      protected UUID getId()
    • isActive

      public Boolean isActive()
    • getTitle

      public abstract String getTitle()
    • getName

      public String getName()
    • start

      public void start()
      Do whatever needs to be done to start this story point. Specific story point types may need to override this
    • complete

      public void complete()
      Complete the story point, by processing outcomes, triggers, and proceeding to the next story point. Specific story point types may need to override this.
    • getResult

      protected abstract String getResult()
      Returns a string specifying the result from this StoryPoint. This can be used to identify different possible results, when multiple results are possible. If different results are not possible, an empty string can be returned.
      Returns:
      A String specifying the result
    • getObjective

      protected String getObjective()
      Returns a string to be used in the "Objectives" panel so players know what they should be doing next.
      Returns:
      a String indicating what to show in the objective screen.
    • proceedToNextStoryPoint

      protected void proceedToNextStoryPoint()
      Gets the next story point and if it is not null, starts it
    • getNextStoryPoint

      protected StoryPoint getNextStoryPoint()
      determine the next story point in the story arc based on the point. This could have been changed depending on StoryOutcome
    • getCampaign

      public Campaign getCampaign()
    • writeToXml

      public abstract void writeToXml(PrintWriter pw1, int indent)
    • writeToXmlBegin

      protected void writeToXmlBegin(PrintWriter pw1, int indent)
    • writeToXmlEnd

      protected void writeToXmlEnd(PrintWriter pw1, int indent)
    • loadFieldsFromXmlNode

      protected abstract void loadFieldsFromXmlNode(Node wn, Campaign c, megamek.Version version) throws ParseException
      Throws:
      ParseException
    • generateInstanceFromXML

      public static StoryPoint generateInstanceFromXML(Node wn, Campaign c, megamek.Version version)