Class StoryArc

java.lang.Object
mekhq.campaign.storyarc.StoryArc

public class StoryArc extends Object
The Story Arc class manages a given story arc campaign.

The main component that makes up a story arc is a series of StoryPoint objects. These objects are tracked in a hash on StoryArc by their uuid. Each StoryPoint can point to other StoryPoints and this can be used to chain StoryPoints together into a (potentially branching) narrative. More information on how StoryPoints work is provided in that class.

A secondary hash of Personality objects contains information on characters that may be associated with the story arc.

The StoryArc uses listeners to implement several handle methods that are waiting for various events to happen in the game. These are used to complete certain StoryPoints that are left active after starting (e.g. wait for a scenario to be completed).

The StoryArc also tracks a has of string variables that can be used to track variables associated with the story arc that might change (e.g. said yes or no to some question).

A note to future developers: I have tried to implement story arcs in a way that makes adding future features straightforward and avoids creating complexity and bloat. Most questions of "How can I add this feature?" should be addressable by creating new StoryPoint and/or StoryTrigger classes and should not require modifying the fundamental architecture of Story Arcs.

  • Constructor Details

    • StoryArc

      public StoryArc()
  • Method Details

    • setCampaign

      public void setCampaign(Campaign c)
    • getCampaign

      public Campaign getCampaign()
    • getTitle

      public String getTitle()
    • getDetails

      public String getDetails()
    • getDescription

      public String getDescription()
    • getStoryLoadingType

      public StoryLoadingType getStoryLoadingType()
    • setInitCampaignPath

      public void setInitCampaignPath(String s)
    • getInitCampaignFile

      public File getInitCampaignFile()
    • setDirectoryPath

      public void setDirectoryPath(String p)
    • getDirectoryPath

      public String getDirectoryPath()
    • getStoryPoint

      public StoryPoint getStoryPoint(UUID id)
    • getPersonality

      public Personality getPersonality(UUID id)
    • addCustomStringVariable

      public void addCustomStringVariable(String key, String value)
    • getCustomStringVariable

      public String getCustomStringVariable(String key)
    • getCustomStringVariables

      public Map<String,String> getCustomStringVariables()
    • begin

      public void begin()
    • initializeDataDirectories

      public void initializeDataDirectories()
    • getCurrentObjectives

      public List<String> getCurrentObjectives()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • handleScenarioResolved

      public void handleScenarioResolved(ScenarioResolvedEvent ev)
    • handleTransitComplete

      public void handleTransitComplete(TransitCompleteEvent ev)
    • handleNewDay

      public void handleNewDay(NewDayEvent ev)
    • handlePersonChanged

      public void handlePersonChanged(PersonStatusChangedEvent ev)
    • writeToXml

      public void writeToXml(PrintWriter pw1, int indent)
    • parseStoryPoints

      protected void parseStoryPoints(NodeList nl, Campaign c, megamek.Version version)
    • parsePersonalities

      protected void parsePersonalities(NodeList nl, Campaign c)
    • parseCustomStringVariables

      protected void parseCustomStringVariables(NodeList nl)
    • parseCustomStringVariable

      protected void parseCustomStringVariable(NodeList nl)
    • parseFromXML

      @Nullable public static StoryArc parseFromXML(NodeList nl, Campaign c, megamek.Version version)
    • parseFromFile

      @Nullable public static StoryArc parseFromFile(@Nullable File file, Campaign c)
    • replaceTokens

      public static String replaceTokens(String text, Campaign c)
      This method will replace tokens in narrative text
      Parameters:
      text - String containing the original text with tokens.
      Returns:
      String containing the text with tokens replaced.