Class BattleResult
java.lang.Object
model.battle.BattleResult
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 Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether the battle is over (at least one side has reached 0 HP).private EntityThe loser (nullin case of a draw).private ActionResultAction result for entityA.private ActionResultAction result for entityB.private EntityThe winner (nullin case of a draw). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetLoser()Summarises what happened this turn, including both sides' results, and announces the winner if the battle is over.booleanvoidsetBattleOver(boolean b) voidvoidvoidvoid
-
Field Details
-
resultA
Action result for entityA. -
resultB
Action result for entityB. -
battleOver
private boolean battleOverWhether the battle is over (at least one side has reached 0 HP). -
winner
The winner (nullin case of a draw). -
loser
The loser (nullin case of a draw).
-
-
Constructor Details
-
BattleResult
public BattleResult()
-
-
Method Details
-
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
- Returns:
- Action result for entityA.
-
setResultA
- Parameters:
r- Action result for entityA.
-
getResultB
- Returns:
- Action result for entityB.
-
setResultB
- Parameters:
r- Action result for entityB.
-
isBattleOver
public boolean isBattleOver()- Returns:
trueif the battle is over
-
setBattleOver
public void setBattleOver(boolean b) - Parameters:
b-trueto mark the battle as over
-
getWinner
- Returns:
- The winner, or
nullfor a draw
-
setWinner
- Parameters:
w- The winning entity
-
getLoser
- Returns:
- The loser, or
nullfor a draw
-
setLoser
- Parameters:
l- The losing entity
-