Record Class EntityCombat.Builder<I>
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.rules.combat.EntityCombat.Builder<I>
- Type Parameters:
I- plugin-defined input for each run- Record Components:
entities- function that supplies initial entity states for the current inputprediction- entity prediction functionlineOfSight- line-of-sight rule
- Enclosing class:
EntityCombat
public static record EntityCombat.Builder<I>(Function<I,? extends Collection<SimulationEntity>> entities, EntityCombat.Prediction<I> prediction, SimulationEntity.LineOfSight<? super I> lineOfSight)
extends Record
Builder for entity combat tasks.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(Function<I, ? extends Collection<SimulationEntity>> entities, EntityCombat.Prediction<I> prediction, SimulationEntity.LineOfSight<? super I> lineOfSight) Creates an instance of aBuilderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionavoid()Builds a task that rejects candidates hit by predicted entity attacks.avoid(int penalty) Builds a task that rejects candidates hit by predicted entity attacks and records a penalty.Function<I, ? extends Collection<SimulationEntity>> entities()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.SimulationEntity.LineOfSight<? super I> Returns the value of thelineOfSightrecord component.lineOfSight(SimulationEntity.LineOfSight<? super I> lineOfSight) Uses a custom line-of-sight rule.penalty(int penalty) Builds a task that penalizes candidates hit by predicted entity attacks.Returns the value of thepredictionrecord component.predictWith(EntityCombat.Prediction<I> prediction) Uses a custom entity prediction function.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Builder
public Builder(Function<I, ? extends Collection<SimulationEntity>> entities, EntityCombat.Prediction<I> prediction, SimulationEntity.LineOfSight<? super I> lineOfSight) Creates an instance of aBuilderrecord class.- Parameters:
entities- the value for theentitiesrecord componentprediction- the value for thepredictionrecord componentlineOfSight- the value for thelineOfSightrecord component
-
-
Method Details
-
predictWith
Uses a custom entity prediction function.- Parameters:
prediction- entity prediction function
-
lineOfSight
Uses a custom line-of-sight rule.- Parameters:
lineOfSight- line-of-sight rule
-
penalty
Builds a task that penalizes candidates hit by predicted entity attacks.- Parameters:
penalty- penalty amount to add when a predicted entity can attack the candidate
-
avoid
Builds a task that rejects candidates hit by predicted entity attacks. -
avoid
Builds a task that rejects candidates hit by predicted entity attacks and records a penalty.- Parameters:
penalty- penalty amount to add when a predicted entity can attack the candidate
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
entities
Returns the value of theentitiesrecord component.- Returns:
- the value of the
entitiesrecord component
-
prediction
Returns the value of thepredictionrecord component.- Returns:
- the value of the
predictionrecord component
-
lineOfSight
Returns the value of thelineOfSightrecord component.- Returns:
- the value of the
lineOfSightrecord component
-