public class BattleLog
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BattleLog.BattleTurnLog |
Modifier and Type | Field and Description |
---|---|
protected java.time.Instant |
battleStart |
protected BattleController |
bc |
protected BattleLog.BattleTurnLog |
currentTurnLog |
protected java.util.Map<java.lang.Integer,BattleLog.BattleTurnLog> |
logs |
Constructor and Description |
---|
BattleLog(BattleController bc)
Initializes a battle log.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<java.io.File> |
exportLogFile(java.lang.String message,
java.lang.Exception exception) |
BattleAction |
getActionForPokemon(int turn,
PixelmonWrapper pw)
Gets a specific action for a Pokémon in the battle log.
|
java.util.List<BattleAction> |
getAllActions() |
java.lang.String |
getFilename() |
void |
logEvent(BattleAction event)
Adds an action to the current turn in the battle log.
|
void |
onCrash(java.lang.Exception exc,
java.lang.String error)
Logs a crash in the battle log and ends the battle.
|
void |
turnTick(int turn)
Moves the log on to the next turn (with the given turn id)
|
protected final BattleController bc
protected final java.time.Instant battleStart
protected final java.util.Map<java.lang.Integer,BattleLog.BattleTurnLog> logs
protected BattleLog.BattleTurnLog currentTurnLog
public BattleLog(BattleController bc)
bc
- The battle to log.public void logEvent(BattleAction event)
event
- The action to add.@Nullable public BattleAction getActionForPokemon(int turn, PixelmonWrapper pw)
turn
- The turn to get an action from.pw
- The Pokémon to get an action for.public void turnTick(int turn)
public void onCrash(java.lang.Exception exc, java.lang.String error)
exc
- The exception thrown by the battle.error
- The error message from the exception.public java.util.List<BattleAction> getAllActions()
public java.util.concurrent.CompletableFuture<java.io.File> exportLogFile(java.lang.String message, java.lang.Exception exception) throws java.lang.Exception
java.lang.Exception
public java.lang.String getFilename()