Class Trace

java.lang.Object
net.demilich.metastone.game.logic.Trace
All Implemented Interfaces:
Serializable, Cloneable

public class Trace extends Object implements Serializable, Cloneable
Stores information about a game context that allows you to reproduce exactly what happened in the match.

Given the seed, starting conditions and index of each action in the available actions that a player chose, the game will reproduce.

See Also:
  • Constructor Details

    • Trace

      public Trace()
  • Method Details

    • setStartState

      public void setStartState(GameState gameState)
    • setSeed

      public void setSeed(long seed)
    • getSeed

      public long getSeed()
    • setCatalogueVersion

      public void setCatalogueVersion(int catalogueVersion)
    • getCatalogueVersion

      public int getCatalogueVersion()
    • getActions

      public List<Integer> getActions()
    • addAction

      public void addAction(GameAction action)
    • replayContext

      public GameContext replayContext()
    • replayContext

      public GameContext replayContext(boolean skipLastAction)
    • replayContext

      public GameContext replayContext(boolean skipLastAction, @Nullable @Nullable Consumer<GameContext> beforeRequestActionHandler)
      Creates a game context and replays it using data from this trace. A Consumer can be optionally specified that receives the game context before every action taken by either player.
      Parameters:
      skipLastAction -
      beforeRequestActionHandler -
      Returns:
    • restoreStartingStateTo

      public void restoreStartingStateTo(GameContext context)
    • dump

      public String dump()
    • load

      public static Trace load(String trace)
    • getHeroClasses

      public List<String> getHeroClasses()
    • setHeroClasses

      public Trace setHeroClasses(List<String> heroClasses)
    • getDeckCardIds

      public List<DeckTrace> getDeckCardIds()
    • setDeckCardIds

      public Trace setDeckCardIds(List<DeckTrace> deckCardIds)
    • getDeckFormatName

      public String getDeckFormatName()
    • setDeckFormatName

      public Trace setDeckFormatName(String deckFormatName)
    • getDeckFormatSets

      public List<String> getDeckFormatSets()
    • setDeckFormatSets

      public Trace setDeckFormatSets(List<String> deckFormatSets)
    • getSecondPlayerBonusCards

      public List<String> getSecondPlayerBonusCards()
    • setSecondPlayerBonusCards

      public Trace setSecondPlayerBonusCards(List<String> secondPlayerBonusCards)
    • getMulligans

      public List<MulliganTrace> getMulligans()
    • setMulligans

      public Trace setMulligans(List<MulliganTrace> mulligans)
    • setActions

      public Trace setActions(List<Integer> actions)
    • getId

      public String getId()
    • setId

      public Trace setId(String id)
    • isTraceErrors

      public boolean isTraceErrors()
    • setTraceErrors

      public Trace setTraceErrors(boolean traceErrors)
    • getRawActions

      public List<GameAction> getRawActions()
    • setRawActions

      public Trace setRawActions(List<GameAction> rawActions)
    • getVersion

      public int getVersion()
    • setVersion

      public Trace setVersion(int version)
    • clone

      public Trace clone()
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJson

      public io.vertx.core.json.JsonObject toJson()