BuilderActionAttack class
Пакет: com.hypixel.hytale.server.npc.corecomponents.combat.builders
Файл: com/hypixel/hytale/server/npc/corecomponents/combat/builders/BuilderActionAttack.java
extends: BuilderActionBase
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
String |
ATTACK_PARAMETER |
|
String |
var2 |
Методы (13)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
return new |
ActionAttackreturn new ActionAttack(this, var1) |
public |
double[] |
getAimingTimeRangedouble[] getAimingTimeRange(@Nonnull BuilderSupport var1) |
public |
int |
getAttackParameterSlotint getAttackParameterSlot(@Nonnull BuilderSupport var1) |
public |
double[] |
getAttackPauseRangedouble[] getAttackPauseRange(@Nonnull BuilderSupport var1) |
public |
ActionAttack.AttackType |
getAttackTypeActionAttack.AttackType getAttackType(@Nonnull BuilderSupport var1) |
public |
ActionAttack.BallisticMode |
getBallisticModeActionAttack.BallisticMode getBallisticMode() |
public |
double |
getChargeDistancedouble getChargeDistance(@Nonnull BuilderSupport var1) |
public |
float |
getChargeTimefloat getChargeTime(@Nonnull BuilderSupport var1) |
public |
double |
getMeleeConeAngledouble getMeleeConeAngle() |
public |
boolean |
isAvoidFriendlyFireboolean isAvoidFriendlyFire() |
public |
boolean |
isCheckLineOfSightboolean isCheckLineOfSight() |
public |
boolean |
isDamageFriendliesboolean isDamageFriendlies() |
public |
boolean |
isSkipAimingboolean isSkipAiming() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.combat.builders;
class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderCodecObjectHelper;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.InstructionType;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.AssetHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.DoubleHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.EnumHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.FloatHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.NumberArrayHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.AssetValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleRangeValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleSequenceValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleSingleValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.asset.CombatInteractionValidator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.combat.ActionAttack;
class="kw">import java.util.Map;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class BuilderActionAttack class="kw">extends BuilderActionBase {
class="kw">private class="kw">static class="kw">final String ATTACK_PARAMETER = "Attack";
class="kw">public class="kw">static class="kw">final String[] ANTECEDENT = new String[]{"SkipAiming"};
class="kw">public class="kw">static class="kw">final String[] SUBSEQUENT = new String[]{"LineOfSight", "AvoidFriendlyFire"};
class="kw">public class="kw">static class="kw">final double[] DEFAULT_ATTACK_PAUSE_RANGE = new double[]{0.0, 0.0};
class="kw">public class="kw">static class="kw">final double[] DEFAULT_AIMING_TIME_RANGE = new double[]{0.0, 0.0};
class="kw">protected class="kw">final AssetHolder attack = new AssetHolder();
class="kw">protected class="kw">final EnumHolder<ActionAttack.AttackType> attackType = new EnumHolder<>();
class="kw">protected class="kw">final FloatHolder chargeFor = new FloatHolder();
class="kw">protected class="kw">final NumberArrayHolder attackPauseRange = new NumberArrayHolder();
class="kw">protected class="kw">final NumberArrayHolder aimingTimeRange = new NumberArrayHolder();
class="kw">protected double meleeConeAngle;
class="kw">protected ActionAttack.BallisticMode ballisticMode = ActionAttack.BallisticMode.Short;
class="kw">protected boolean checkLineOfSight;
class="kw">protected boolean avoidFriendlyFire;
class="kw">protected boolean damageFriendlies;
class="kw">protected boolean skipAiming;
class="kw">protected DoubleHolder chargeDistance = new DoubleHolder();
class="kw">protected class="kw">final BuilderCodecObjectHelper<Map<String, String>> interactionVars = new BuilderCodecObjectHelper<>(
RootInteraction.class, RootInteraction.CHILD_ASSET_CODEC_MAP, null
);
class="kw">protected boolean attackProvided;
class="kw">public BuilderActionAttack() {
}
@Nonnull
class="kw">public ActionAttack build(@Nonnull BuilderSupport var1) {
class="kw">return new ActionAttack(this, var1);
}
@Nonnull
@Override
class="kw">public String getShortDescription() {
class="kw">return "Starts attack";
}
@Nonnull
@Override
class="kw">public String getLongDescription() {
class="kw">return "Let NPC start an attack. When an attack is running no new attack is started.";
}
@Nonnull
@Override
class="kw">public BuilderDescriptorState getBuilderDescriptorState() {
class="kw">return BuilderDescriptorState.Experimental;
}
@Nonnull
class="kw">public BuilderActionAttack readConfig(@Nonnull JsonElement var1) {
this.attackProvided = this.getAsset(
var1,
"Attack",
this.attack,
null,
CombatInteractionValidator.withConfig(AssetValidator.CanBeEmpty),
BuilderDescriptorState.Experimental,
"Attack pattern to use",
"Attack pattern to use. If omitted, will cancel current attack"
);
this.getEnum(
var1,
"AttackType",
this.attackType,
ActionAttack.AttackType.class,
ActionAttack.AttackType.Primary,
BuilderDescriptorState.Stable,
"The interaction type to use",
null
);
this.getFloat(
var1,
"ChargeFor",
this.chargeFor,
0.0,
DoubleSingleValidator.greaterEqual0(),
BuilderDescriptorState.Stable,
"How long to charge for",
"How long to charge for. 0 indicates no charging. Also doubles as how long to block for"
);
this.getDoubleRange(
var1,
"AttackPauseRange",
this.attackPauseRange,
DEFAULT_ATTACK_PAUSE_RANGE,
DoubleSequenceValidator.betweenWeaklyMonotonic(0.0, Double.MAX_VALUE),
BuilderDescriptorState.Stable,
"Range of minimum pause between attacks",
null
);
this.getDoubleRange(
var1,
"AimingTimeRange",
this.aimingTimeRange,
DEFAULT_AIMING_TIME_RANGE,
DoubleSequenceValidator.betweenWeaklyMonotonic(0.0, Double.MAX_VALUE),
BuilderDescriptorState.Stable,
"A range from which to pick a random value denoting the max time the NPC will wait for aiming before launching the attack.",
null
);
this.getBoolean(
var1, "LineOfSight", var1x -> this.checkLineOfSight = var1x, false, BuilderDescriptorState.Experimental, "Check Line of Sight before firing", null
);
this.getBoolean(
var1,
"AvoidFriendlyFire",
var1x -> this.avoidFriendlyFire = var1x,
true,
BuilderDescriptorState.Experimental,
"Tries to avoid friendly fire if true",
null
);
this.getEnum(
var1,
"BallisticMode",
var1x -> this.ballisticMode = var1x,
ActionAttack.BallisticMode.class,
ActionAttack.BallisticMode.Short,
BuilderDescriptorState.WorkInProgress,
"Trajectory to use",
null
);
this.getDouble(
var1,
"MeleeConeAngle",
var1x -> this.meleeConeAngle = var1x,
30.0,
DoubleRangeValidator.fromExclToIncl(0.0, 360.0),
BuilderDescriptorState.WorkInProgress,
"Cone angle considered for on target for melee",
null
);
this.getBoolean(
var1,
"DamageFriendlies",
var1x -> this.damageFriendlies = var1x,
false,
BuilderDescriptorState.Stable,
"Whether this attack should bypass ignored damage groups and deal damage to the target",
null
);
this.getBoolean(
var1,
"SkipAiming",
var1x -> this.skipAiming = var1x,
false,
BuilderDescriptorState.Stable,
"Whether aiming should be skipped an the attack just executed immediately.",
null
);
this.getDouble(
var1,
"ChargeDistance",
this.chargeDistance,
0.0,
DoubleSingleValidator.greaterEqual0(),
BuilderDescriptorState.Stable,
"If this is a charge attack, the distance required for the charge",
null
);
this.getCodecObject(
var1, "InteractionVars", this.interactionVars, BuilderDescriptorState.Stable, "Set of interaction vars for modifying the interaction", null
);
this.validateBooleanImplicationAnyAntecedent(
ANTECEDENT, new boolean[]{this.skipAiming}, true, SUBSEQUENT, new boolean[]{this.checkLineOfSight, this.avoidFriendlyFire}, false
);
this.requireInstructionType(InstructionType.NPCOnlyInstructions);
this.requireNotInForEach();
class="kw">return this;
}
@Nullable
class="kw">public String getAttack(@Nonnull BuilderSupport var1) {
String var2 = this.attack.get(var1.getExecutionContext());
class="kw">return var2 != null && !var2.isEmpty() ? var2 : null;
}
class="kw">public ActionAttack.AttackType getAttackType(@Nonnull BuilderSupport var1) {
class="kw">return this.attackType.get(var1.getExecutionContext());
}
class="kw">public float getChargeTime(@Nonnull BuilderSupport var1) {
class="kw">return this.chargeFor.get(var1.getExecutionContext());
}
class="kw">public double[] getAttackPauseRange(@Nonnull BuilderSupport var1) {
class="kw">return this.attackPauseRange.get(var1.getExecutionContext());
}
class="kw">public double[] getAimingTimeRange(@Nonnull BuilderSupport var1) {
class="kw">return this.aimingTimeRange.get(var1.getExecutionContext());
}
class="kw">public double getMeleeConeAngle() {
class="kw">return this.meleeConeAngle / 2.0 * (float) (Math.PI / 180.0);
}
class="kw">public ActionAttack.BallisticMode getBallisticMode() {
class="kw">return this.ballisticMode;
}
class="kw">public boolean isCheckLineOfSight() {
class="kw">return this.checkLineOfSight;
}
class="kw">public boolean isAvoidFriendlyFire() {
class="kw">return this.avoidFriendlyFire;
}
class="kw">public boolean isDamageFriendlies() {
class="kw">return this.damageFriendlies;
}
class="kw">public boolean isSkipAiming() {
class="kw">return this.skipAiming;
}
class="kw">public double getChargeDistance(@Nonnull BuilderSupport var1) {
class="kw">return this.chargeDistance.get(var1.getExecutionContext());
}
class="kw">public int getAttackParameterSlot(@Nonnull BuilderSupport var1) {
class="kw">return this.attackProvided ? Integer.MIN_VALUE : var1.getParameterSlot("Attack");
}
@Nullable
class="kw">public Map<String, String> getInteractionVars() {
class="kw">return this.interactionVars.build();
}
}