Class StoryArc
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomStringVariable
(String key, String value) void
begin()
getPersonality
(UUID id) getStoryPoint
(UUID id) getTitle()
void
void
void
void
void
protected void
protected void
static StoryArc
parseFromFile
(File file, Campaign c) static StoryArc
parseFromXML
(NodeList nl, Campaign c, megamek.Version version) protected void
parsePersonalities
(NodeList nl, Campaign c) protected void
parseStoryPoints
(NodeList nl, Campaign c, megamek.Version version) static String
replaceTokens
(String text, Campaign c) This method will replace tokens in narrative textvoid
void
void
toString()
void
writeToXml
(PrintWriter pw1, int indent)
-
Constructor Details
-
StoryArc
public StoryArc()
-
-
Method Details
-
setCampaign
-
getCampaign
-
getTitle
-
getDetails
-
getDescription
-
getStoryLoadingType
-
setInitCampaignPath
-
getInitCampaignFile
-
setDirectoryPath
-
getDirectoryPath
-
getStoryPoint
-
getPersonality
-
addCustomStringVariable
-
getCustomStringVariable
-
getCustomStringVariables
-
begin
public void begin() -
initializeDataDirectories
public void initializeDataDirectories() -
getCurrentObjectives
-
toString
-
handleScenarioResolved
-
handleTransitComplete
-
handleNewDay
-
handlePersonChanged
-
writeToXml
-
parseStoryPoints
-
parsePersonalities
-
parseCustomStringVariables
-
parseCustomStringVariable
-
parseFromXML
-
parseFromFile
-
replaceTokens
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.
-