Record Class SimulationCombatState

java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.combat.SimulationCombatState
Record Components:
player - simulated player area
entities - simulated entity states at this tick
timeline - predicted combat events accumulated by this branch
tick - 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.
  • Constructor Details

    • SimulationCombatState

      public SimulationCombatState(Rect player, List<SimulationEntity> entities, SimulationTimeline timeline, int tick)
      Creates an instance of a SimulationCombatState record class.
      Parameters:
      player - the value for the player record component
      entities - the value for the entities record component
      timeline - the value for the timeline record component
      tick - the value for the tick record component
  • Method Details

    • start

      public static SimulationCombatState start(Rect player, List<SimulationEntity> entities)
      Creates an initial combat state.
      Parameters:
      player - simulated player area
      entities - initial simulated entity states
    • step

      public SimulationCombatState step(Rect target)
      Advances combat by one tick after moving the player to target.
      Parameters:
      target - next simulated player area
    • step

      Advances combat by one tick after moving the player to target.
      Parameters:
      target - next simulated player area
      prediction - entity prediction function
      lineOfSight - line-of-sight rule for attacks
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • player

      public Rect player()
      Returns the value of the player record component.
      Returns:
      the value of the player record component
    • entities

      public List<SimulationEntity> entities()
      Returns the value of the entities record component.
      Returns:
      the value of the entities record component
    • timeline

      public SimulationTimeline timeline()
      Returns the value of the timeline record component.
      Returns:
      the value of the timeline record component
    • tick

      public int tick()
      Returns the value of the tick record component.
      Returns:
      the value of the tick record component