Class MoralDecision

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.moral.MoralDecision

public class MoralDecision extends Component
The MoralDecision class manages a list of moral decisions and tracks the current morality score.
  • Constructor Details

    • MoralDecision

      public MoralDecision()
  • Method Details

    • addQuestion

      public boolean addQuestion(String question)
      Adds a new Question, assuming it is good and worth 10 points.
      Parameters:
      question - the question or statement of the decision
      Returns:
      true if the decision was added successfully
    • addQuestion

      public boolean addQuestion(String question, boolean isGood, int effectMoney)
      Adds a new Question with the specified question, goodness, and decision points.
      Parameters:
      question - the question or statement of the decision
      isGood - whether the effect is positive or negative
      effectMoney - Money to be added or subtracted. Add/sub controlled by isGood
      Returns:
      true if the decision was added successfully
    • addDecision

      public void addDecision(Decision decision)
      Adds an existing Decision object to the list of decisions.
      Parameters:
      decision - the Decision object to add
    • getDecision

      public boolean getDecision(int index)
      Returns the result of the decision at the specified index.
      Parameters:
      index - the index of the decision
      Returns:
      the result of the decision, or false if the decision is not found
    • getDecision

      public boolean getDecision(String question)
      Returns the result of the decision with the specified question.
      Parameters:
      question - the question or statement of the decision
      Returns:
      the result of the decision, or false if the decision is not found
    • getCurrentMorality

      public Boolean getCurrentMorality()
      Returns the current morality score.
      Returns:
      the current morality score
    • setCurrentMorality

      public void setCurrentMorality(Boolean currentMorality)
      Sets the current morality score.
      Parameters:
      currentMorality - the new morality score
    • setDecision

      public boolean setDecision(int index, boolean decision)
      Sets the decision result at the specified index and updates the morality score.
      Parameters:
      index - the index of the decision
      decision - the result of the decision
      Returns:
      true if the decision was set successfully
    • getListOfDecisions

      public List<Decision> getListOfDecisions()
      Returns the list of decisions.
      Returns:
      the list of decisions
    • getDecisionQuestion

      public String getDecisionQuestion(int index)
      Returns the statement of the decision at the specified index.
      Parameters:
      index - the index of the decision
      Returns:
      the statement of the decision
    • clearDecisions

      public void clearDecisions()
      Clears all decisions from the list.
    • removeDecision

      public void removeDecision(int index)
      Removes the decision at the specified index.
      Parameters:
      index - the index of the decision to remove
    • removeDecision

      public void removeDecision(Decision decision)
      Removes the specified Decision object from the list.
      Parameters:
      decision - the Decision object to remove
    • removeDecision

      public void removeDecision(String question)
      Removes the decision with the specified question from the list.
      Parameters:
      question - the question or statement of the decision to remove