Class BattleResult

java.lang.Object
model.battle.BattleResult

public class BattleResult extends Object
Aggregate result of one turn, containing ActionResults for both sides as well as information on whether the battle has ended and who won or lost.
  • Field Details

    • resultA

      private ActionResult resultA
      Action result for entityA.
    • resultB

      private ActionResult resultB
      Action result for entityB.
    • battleOver

      private boolean battleOver
      Whether the battle is over (at least one side has reached 0 HP).
    • winner

      private Entity winner
      The winner (null in case of a draw).
    • loser

      private Entity loser
      The loser (null in case of a draw).
  • Constructor Details

    • BattleResult

      public BattleResult()
  • Method Details

    • getSummary

      public String getSummary()
      Summarises what happened this turn, including both sides' results, and announces the winner if the battle is over.
      Returns:
      A summary of this turn
    • getResultA

      public ActionResult getResultA()
      Returns:
      Action result for entityA.
    • setResultA

      public void setResultA(ActionResult r)
      Parameters:
      r - Action result for entityA.
    • getResultB

      public ActionResult getResultB()
      Returns:
      Action result for entityB.
    • setResultB

      public void setResultB(ActionResult r)
      Parameters:
      r - Action result for entityB.
    • isBattleOver

      public boolean isBattleOver()
      Returns:
      true if the battle is over
    • setBattleOver

      public void setBattleOver(boolean b)
      Parameters:
      b - true to mark the battle as over
    • getWinner

      public Entity getWinner()
      Returns:
      The winner, or null for a draw
    • setWinner

      public void setWinner(Entity w)
      Parameters:
      w - The winning entity
    • getLoser

      public Entity getLoser()
      Returns:
      The loser, or null for a draw
    • setLoser

      public void setLoser(Entity l)
      Parameters:
      l - The losing entity