Class StoryPoint
- Direct Known Subclasses:
CheckDateReachedStoryPoint,CheckMoreScenariosStoryPoint,CheckPersonStatusStoryPoint,CheckStringVariableStoryPoint,CreateCharacterStoryPoint,DialogStoryPoint,MissionStoryPoint,PersonStatusStoryPoint,RollDiceStoryPoint,ScenarioStoryPoint,TravelStoryPoint,WaitStoryPoint
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 Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,StoryOutcome> A map of all possible StoryOutcomes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Complete the story point, by processing outcomes, triggers, and proceeding to the next story point.static StoryPointgenerateInstanceFromXML(Node wn, Campaign c, megamek.Version version) protected UUIDgetId()getName()protected StoryPointdetermine the next story point in the story arc based on the point.protected StringReturns a string to be used in the "Objectives" panel so players know what they should be doing next.protected abstract StringReturns a string specifying the result from this StoryPoint.protected StoryArcabstract StringgetTitle()isActive()protected abstract voidloadFieldsFromXmlNode(Node wn, Campaign c, megamek.Version version) protected voidGets the next story point and if it is not null, starts itvoidvoidvoidstart()Do whatever needs to be done to start this story point.abstract voidwriteToXml(PrintWriter pw1, int indent) protected voidwriteToXmlBegin(PrintWriter pw1, int indent) protected voidwriteToXmlEnd(PrintWriter pw1, int indent)
-
Field Details
-
storyOutcomes
A map of all possible StoryOutcomes
-
-
Constructor Details
-
StoryPoint
public StoryPoint()
-
-
Method Details
-
setStoryArc
-
getStoryArc
-
setId
-
getId
-
isActive
-
getTitle
-
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
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
Returns a string to be used in the "Objectives" panel so players know what they should be doing next.- Returns:
- a
Stringindicating 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
determine the next story point in the story arc based on the point. This could have been changed depending on StoryOutcome -
getCampaign
-
writeToXml
-
writeToXmlBegin
-
writeToXmlEnd
-
loadFieldsFromXmlNode
protected abstract void loadFieldsFromXmlNode(Node wn, Campaign c, megamek.Version version) throws ParseException - Throws:
ParseException
-
generateInstanceFromXML
-