Record Class SimulationCombatState
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.combat.SimulationCombatState
- Record Components:
player- simulated player areaentities- simulated entity states at this ticktimeline- predicted combat events accumulated by this branchtick- current simulated tick
public record SimulationCombatState(Rect player, List<SimulationEntity> entities, SimulationTimeline timeline, int tick)
extends Record
Combat rollout state for branch-local entity prediction.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePredicts one entity for one combat tick. -
Constructor Summary
ConstructorsConstructorDescriptionSimulationCombatState(Rect player, List<SimulationEntity> entities, SimulationTimeline timeline, int tick) Creates an instance of aSimulationCombatStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionentities()Returns the value of theentitiesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.player()Returns the value of theplayerrecord component.static SimulationCombatStatestart(Rect player, List<SimulationEntity> entities) Creates an initial combat state.Advances combat by one tick after moving the player totarget.step(Rect target, SimulationCombatState.Prediction prediction, SimulationEntity.LineOfSight<? super SimulationCombatState> lineOfSight) Advances combat by one tick after moving the player totarget.inttick()Returns the value of thetickrecord component.timeline()Returns the value of thetimelinerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SimulationCombatState
public SimulationCombatState(Rect player, List<SimulationEntity> entities, SimulationTimeline timeline, int tick) Creates an instance of aSimulationCombatStaterecord class.
-
-
Method Details
-
start
Creates an initial combat state.- Parameters:
player- simulated player areaentities- initial simulated entity states
-
step
Advances combat by one tick after moving the player totarget.- Parameters:
target- next simulated player area
-
step
public SimulationCombatState step(Rect target, SimulationCombatState.Prediction prediction, SimulationEntity.LineOfSight<? super SimulationCombatState> lineOfSight) Advances combat by one tick after moving the player totarget.- Parameters:
target- next simulated player areaprediction- entity prediction functionlineOfSight- line-of-sight rule for attacks
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
player
Returns the value of theplayerrecord component.- Returns:
- the value of the
playerrecord component
-
entities
Returns the value of theentitiesrecord component.- Returns:
- the value of the
entitiesrecord component
-
timeline
Returns the value of thetimelinerecord component.- Returns:
- the value of the
timelinerecord component
-
tick
public int tick()Returns the value of thetickrecord component.- Returns:
- the value of the
tickrecord component
-