classpublicPriority 3
RecentSustainedDamageCondition
com.hypixel.hytale.builtin.npccombatactionevaluator.conditions.RecentSustainedDamageCondition
extends ScaledCurveCondition
1
Methods
1
Public Methods
0
Fields
1
Constructors
Constants
BuilderCodec<RecentSustainedDamageCondition>CODEC= BuilderCodec.builder(
RecentSustainedDamageCondition.class, RecentSustainedDamageConditi...
ComponentType<EntityStore, DamageMemory>DAMAGE_MEMORY_COMPONENT_TYPE= DamageMemory.getComponentType()
Constructors
public
RecentSustainedDamageCondition()Methods
Public Methods (1)
public
void setupNPC(Holder<EntityStore> holder)@Override
Inheritance
Parent
Current
Interface
Child
Use mouse wheel to zoom, drag to pan. Click nodes to navigate.
Related Classes
Source Code
package com.hypixel.hytale.builtin.npccombatactionevaluator.conditions;
import com.hypixel.hytale.builtin.npccombatactionevaluator.memory.DamageMemory;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.npc.decisionmaker.core.EvaluationContext;
import com.hypixel.hytale.server.npc.decisionmaker.core.conditions.base.ScaledCurveCondition;
import javax.annotation.Nonnull;
public class RecentSustainedDamageCondition extends ScaledCurveCondition {
public static final BuilderCodec<RecentSustainedDamageCondition> CODEC = BuilderCodec.builder(
RecentSustainedDamageCondition.class, RecentSustainedDamageCondition::new, ScaledCurveCondition.ABSTRACT_CODEC
)
.documentation("A scaled curve condition that returns a utility value based on damage taken since the combat action evaluator was last run.")
.build();
protected static final ComponentType<EntityStore, DamageMemory> DAMAGE_MEMORY_COMPONENT_TYPE = DamageMemory.getComponentType();
public RecentSustainedDamageCondition() {
}
@Override
protected double getInput(
int selfIndex,
@Nonnull ArchetypeChunk<EntityStore> archetypeChunk,
Ref<EntityStore> target,
CommandBuffer<EntityStore> commandBuffer,
EvaluationContext context
) {
DamageMemory memory = archetypeChunk.getComponent(selfIndex, DAMAGE_MEMORY_COMPONENT_TYPE);
return (double)memory.getRecentDamage();
}
@Override
public void setupNPC(@Nonnull Holder<EntityStore> holder) {
holder.ensureComponent(DAMAGE_MEMORY_COMPONENT_TYPE);
}
}