Class SimulationNode
java.lang.Object
dev.twilite.game.simulation.model.SimulationNode
Mutable state for one simulated movement candidate.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaction(SimulationActionType type) Returns whether this node has an action signal of the requested type.actions()Returns typed action signals attached to this node.voidaddAction(SimulationAction action) Adds a typed action signal to this node.voidaddHit(SimulationHit hit) Adds a predicted hit to this node's combat timeline.voidaddPathPenalty(int penalty) voidaddPenalty(int penalty) Adds penalty to this node.voidaddScore(int score) Adds preference score to this node.booleanavoid()Returns whether this node is reachable but should not be selected as the final result.voidavoid(boolean avoid) Sets whether this node is reachable but should not be selected as the final result.voidblock()Excludes this node from traversal and result selection.booleanblocked()Returns whether this node is excluded from traversal and result selection.intlength()Returns the expanded path length before reaching this node.voidlength(int length) parent()Returns the previous coordinate on the path to this candidate.voidintpenalty()Returns the accumulated penalty score for the path to this node.position()Returns this candidate's coordinate in the simulation grid.intscore()Returns the accumulated preference score for this node.inttick()Returns the simulated tick when this node is reached.voidtick(int tick) timeline()Returns predicted combat events attached to this node.
-
Constructor Details
-
SimulationNode
-
-
Method Details
-
position
Returns this candidate's coordinate in the simulation grid. -
parent
Returns the previous coordinate on the path to this candidate. -
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
Returns typed action signals attached to this node. -
addAction
Adds a typed action signal to this node.- Parameters:
action- action signal to attach
-
action
Returns whether this node has an action signal of the requested type.- Parameters:
type- action type to test
-
timeline
Returns predicted combat events attached to this node. -
addHit
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)
-