Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getComponentType()
- getRunOption()
- getMinRunUtility()
- getEvaluationContext()
- getLastRunNanos()
- setLastRunNanos(long)
- getRunInState()
- getOptionsBySubState()
- getBasicAttacks(int)
- setCurrentBasicAttackSet(int, CombatActionEvaluatorConfig.BasicAttacks)
- getCurrentBasicAttack()
- getCurrentBasicAttackSet()
- setCurrentBasicAttack(String, boolean, Function)
- getNextBasicAttackIndex()
- setNextBasicAttackIndex(int)
- canUseBasicAttack(int, ArchetypeChunk, CommandBuffer)
- tickBasicAttackCoolDown(float)
- getBasicAttackTarget()
- setBasicAttackTarget(Ref)
- tickBasicAttackTimeout(float)
- setBasicAttackTimeout(double)
- getPrimaryTarget()
- clearPrimaryTarget()
- setActiveOptions(List)
- getMarkedTargetSlot()
- getMaxRangeSlot()
- getMinRangeSlot()
- getPositioningAngleSlot()
- getCurrentAttack()
- getChargeFor()
- getCurrentInteractionType()
- getCurrentInteractionVarsGetter()
- shouldDamageFriendlies()
- requiresAiming()
- shouldPositionFirst()
- getChargeDistance()
- setCurrentInteraction(String, InteractionType, float, boolean, boolean, boolean, double, Function)
- getCurrentAction()
- consumePostExecutionDistanceRange()
- setTimeout(float)
- clearTimeout()
- hasTimedOut(float)
- selectNextCombatAction(int, ArchetypeChunk, CommandBuffer, ExecutionSupport, ValueStore)
- completeCurrentAction(boolean, boolean)
- terminateCurrentAction()
- clearCurrentBasicAttack()
- setupNPC(ExecutionSupport)
- setupNPC(Holder)
- clone()
Class CombatActionEvaluator
java.lang.Object
com.hypixel.hytale.server.npc.decisionmaker.core.Evaluator<CombatActionOption>
com.hypixel.hytale.builtin.npccombatactionevaluator.evaluator.CombatActionEvaluator
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
public class CombatActionEvaluator
extends Evaluator<CombatActionOption>
implements Component<EntityStore>
An evaluator designed to handle smartly selecting combat abilities based on world state and various parameters. This includes selecting combat abilities
periodically and using frequent basic attacks around them.
- Since:
- 2021/03/15
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassstatic classclassNested classes/interfaces inherited from class Evaluator
Evaluator.OptionHolder -
Field Summary
Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionCombatActionEvaluator(StateSupport stateSupport, CombatActionEvaluatorConfig config, CombatActionEvaluatorSystems.CombatConstructionData data) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUseBasicAttack(int selfIndex, ArchetypeChunk<EntityStore> archetypeChunk, CommandBuffer<EntityStore> commandBuffer) voidvoidvoidclone()voidcompleteCurrentAction(boolean forceClearAbility, boolean clearBasicAttack) Completes the current active action and marks the evaluator as having successfully completed its run.double[]getBasicAttacks(int subState) doublefloatlongintintintdoubleintit.unimi.dsi.fastutil.ints.Int2ObjectMap<List<Evaluator<CombatActionOption>.OptionHolder>> intintbooleanhasTimedOut(float dt) booleanvoidselectNextCombatAction(int index, ArchetypeChunk<EntityStore> archetypeChunk, CommandBuffer<EntityStore> commandBuffer, ExecutionSupport executionSupport, ValueStore valueStore) voidsetActiveOptions(List<Evaluator<CombatActionOption>.OptionHolder> options) voidsetBasicAttackTarget(Ref<EntityStore> target) voidsetBasicAttackTimeout(double timeout) voidsetCurrentBasicAttack(String attack, boolean damageFriendlies, Function<InteractionContext, Map<String, String>> interactionVarsGetter) voidsetCurrentBasicAttackSet(int subState, CombatActionEvaluatorConfig.BasicAttacks attacks) voidsetCurrentInteraction(String currentInteraction, InteractionType interactionType, float chargeFor, boolean damageFriendlies, boolean requireAiming, boolean positionFirst, double chargeDistance, Function<InteractionContext, Map<String, String>> interactionVarsGetter) voidsetLastRunNanos(long lastRunNanos) voidsetNextBasicAttackIndex(int next) voidsetTimeout(float timeout) voidsetupNPC(Holder<EntityStore> holder) This method handles initialisation of any parts of the evaluator that require access to external components.voidsetupNPC(ExecutionSupport executionSupport) This method should be called within the position cache initialisation when an NPC is instantiated and handles initialising values on the NPC itself so that it can register, compute, and pass relevant data to the conditions for evaluation.booleanbooleanvoidTerminates the current active action but allows a new action to be immediately performed.voidtickBasicAttackCoolDown(float dt) booleantickBasicAttackTimeout(float dt) Methods inherited from class Evaluator
evaluate, initialiseMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Constructor Details
-
CombatActionEvaluator
public CombatActionEvaluator(@Nonnull StateSupport stateSupport, @Nonnull CombatActionEvaluatorConfig config, @Nonnull CombatActionEvaluatorSystems.CombatConstructionData data)
-
-
Method Details
-
getComponentType
-
getRunOption
-
getMinRunUtility
public double getMinRunUtility() -
getEvaluationContext
-
getLastRunNanos
public long getLastRunNanos() -
setLastRunNanos
public void setLastRunNanos(long lastRunNanos) -
getRunInState
public int getRunInState() -
getOptionsBySubState
@Nonnull public it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<Evaluator<CombatActionOption>.OptionHolder>> getOptionsBySubState() -
getBasicAttacks
-
setCurrentBasicAttackSet
public void setCurrentBasicAttackSet(int subState, CombatActionEvaluatorConfig.BasicAttacks attacks) -
getCurrentBasicAttack
-
getCurrentBasicAttackSet
-
setCurrentBasicAttack
-
getNextBasicAttackIndex
public int getNextBasicAttackIndex() -
setNextBasicAttackIndex
public void setNextBasicAttackIndex(int next) -
canUseBasicAttack
public boolean canUseBasicAttack(int selfIndex, ArchetypeChunk<EntityStore> archetypeChunk, CommandBuffer<EntityStore> commandBuffer) -
tickBasicAttackCoolDown
public void tickBasicAttackCoolDown(float dt) -
getBasicAttackTarget
-
setBasicAttackTarget
-
tickBasicAttackTimeout
public boolean tickBasicAttackTimeout(float dt) -
setBasicAttackTimeout
public void setBasicAttackTimeout(double timeout) -
getPrimaryTarget
-
clearPrimaryTarget
public void clearPrimaryTarget() -
setActiveOptions
-
getMarkedTargetSlot
public int getMarkedTargetSlot() -
getMaxRangeSlot
public int getMaxRangeSlot() -
getMinRangeSlot
public int getMinRangeSlot() -
getPositioningAngleSlot
public int getPositioningAngleSlot() -
getCurrentAttack
-
getChargeFor
public float getChargeFor() -
getCurrentInteractionType
-
getCurrentInteractionVarsGetter
-
shouldDamageFriendlies
public boolean shouldDamageFriendlies() -
requiresAiming
public boolean requiresAiming() -
shouldPositionFirst
public boolean shouldPositionFirst() -
getChargeDistance
public double getChargeDistance() -
setCurrentInteraction
public void setCurrentInteraction(String currentInteraction, InteractionType interactionType, float chargeFor, boolean damageFriendlies, boolean requireAiming, boolean positionFirst, double chargeDistance, Function<InteractionContext, Map<String, String>> interactionVarsGetter) -
getCurrentAction
-
consumePostExecutionDistanceRange
public double[] consumePostExecutionDistanceRange() -
setTimeout
public void setTimeout(float timeout) -
clearTimeout
public void clearTimeout() -
hasTimedOut
public boolean hasTimedOut(float dt) -
selectNextCombatAction
public void selectNextCombatAction(int index, @Nonnull ArchetypeChunk<EntityStore> archetypeChunk, CommandBuffer<EntityStore> commandBuffer, @Nonnull ExecutionSupport executionSupport, ValueStore valueStore) -
completeCurrentAction
public void completeCurrentAction(boolean forceClearAbility, boolean clearBasicAttack) Completes the current active action and marks the evaluator as having successfully completed its run. -
terminateCurrentAction
public void terminateCurrentAction()Terminates the current active action but allows a new action to be immediately performed. -
clearCurrentBasicAttack
public void clearCurrentBasicAttack() -
setupNPC
Description copied from class:EvaluatorThis method should be called within the position cache initialisation when an NPC is instantiated and handles initialising values on the NPC itself so that it can register, compute, and pass relevant data to the conditions for evaluation.- Overrides:
setupNPCin classEvaluator<CombatActionOption>
-
setupNPC
Description copied from class:EvaluatorThis method handles initialisation of any parts of the evaluator that require access to external components.- Overrides:
setupNPCin classEvaluator<CombatActionOption>- Parameters:
holder- the holder for the NPC
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-