Class SimulationNode

java.lang.Object
dev.twilite.game.simulation.model.SimulationNode

public class SimulationNode extends Object
Mutable state for one simulated movement candidate.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether this node has an action signal of the requested type.
    Returns typed action signals attached to this node.
    void
    Adds a typed action signal to this node.
    void
    Adds a predicted hit to this node's combat timeline.
    void
    addPathPenalty(int penalty)
     
    void
    addPenalty(int penalty)
    Adds penalty to this node.
    void
    addScore(int score)
    Adds preference score to this node.
    boolean
    Returns whether this node is reachable but should not be selected as the final result.
    void
    avoid(boolean avoid)
    Sets whether this node is reachable but should not be selected as the final result.
    void
    Excludes this node from traversal and result selection.
    boolean
    Returns whether this node is excluded from traversal and result selection.
    int
    Returns the expanded path length before reaching this node.
    void
    length(int length)
     
    Returns the previous coordinate on the path to this candidate.
    void
    parent(Coord parent)
     
    int
    Returns the accumulated penalty score for the path to this node.
    Returns this candidate's coordinate in the simulation grid.
    int
    Returns the accumulated preference score for this node.
    int
    Returns the simulated tick when this node is reached.
    void
    tick(int tick)
     
    Returns predicted combat events attached to this node.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimulationNode

      public SimulationNode(Coord position)
  • Method Details

    • position

      public Coord position()
      Returns this candidate's coordinate in the simulation grid.
    • parent

      public Coord parent()
      Returns the previous coordinate on the path to this candidate.
    • parent

      public void parent(Coord parent)
    • blocked

      public boolean blocked()
      Returns whether this node is excluded from traversal and result selection.
    • block

      public void block()
      Excludes this node from traversal and result selection.
    • avoid

      public boolean avoid()
      Returns whether this node is reachable but should not be selected as the final result.
    • avoid

      public void avoid(boolean avoid)
      Sets whether this node is reachable but should not be selected as the final result.
      Parameters:
      avoid - true to prevent final selection
    • penalty

      public int penalty()
      Returns the accumulated penalty score for the path to this node.
    • addPenalty

      public void addPenalty(int penalty)
      Adds penalty to this node. Lower total penalty is preferred during result selection.
      Parameters:
      penalty - penalty amount to add
    • addPathPenalty

      public void addPathPenalty(int penalty)
    • score

      public int score()
      Returns the accumulated preference score for this node.
    • addScore

      public void addScore(int score)
      Adds preference score to this node. Higher score breaks ties between equal penalty candidates.
      Parameters:
      score - score amount to add
    • actions

      public List<SimulationAction> actions()
      Returns typed action signals attached to this node.
    • addAction

      public void addAction(SimulationAction action)
      Adds a typed action signal to this node.
      Parameters:
      action - action signal to attach
    • action

      public boolean action(SimulationActionType type)
      Returns whether this node has an action signal of the requested type.
      Parameters:
      type - action type to test
    • timeline

      public SimulationTimeline timeline()
      Returns predicted combat events attached to this node.
    • addHit

      public void addHit(SimulationHit hit)
      Adds a predicted hit to this node's combat timeline.
      Parameters:
      hit - predicted hit to attach
    • tick

      public int tick()
      Returns the simulated tick when this node is reached.
    • tick

      public void tick(int tick)
    • length

      public int length()
      Returns the expanded path length before reaching this node.
    • length

      public void length(int length)