mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 02:39:05 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
aa05ef75bb
36 files changed
+1441
-277
No files matched your search
+1
-1
Submodule src/api updated: bf650319da...03be7a5cac.
@@ -2,6 +2,7 @@ package kamkeel.npcs.controllers.data.ability;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
@@ -32,7 +33,6 @@ import noppes.npcs.scripted.event.player.PlayerAbilityEvent;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -148,6 +148,9 @@ public abstract class Ability implements IAbility {
|
||||
public void onComplete(EntityLivingBase caster, EntityLivingBase target) {
|
||||
}
|
||||
|
||||
public void onDamageTaken(EntityLivingBase caster, EntityLivingBase attacker, DamageSource source, float damage) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply damage to an entity with ability hit event support.
|
||||
* Fires the abilityHit script event, allowing scripts to modify or cancel the damage.
|
||||
@@ -341,24 +344,31 @@ public abstract class Ability implements IAbility {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the declarative field definitions for this ability's GUI.
|
||||
* Override in subclasses to declare type-specific and visual fields.
|
||||
* The GUI rendering engine in SubGuiAbilityConfig uses this list to
|
||||
* automatically build the Type and Visual tabs.
|
||||
* Add field definitions for this ability's GUI.
|
||||
* Override in subclasses to add type-specific fields. The list already contains
|
||||
* the base fields (General, Target, Effects tabs), so subclasses can also
|
||||
* modify, insert into, or remove base fields using {@link FieldDef#insertBefore},
|
||||
* {@link FieldDef#insertAfter}, or direct list manipulation.
|
||||
* <p>
|
||||
* Fields added here without an explicit {@code .tab()} will default to the "Type" tab.
|
||||
*
|
||||
* @param defs The mutable list of field definitions to add to or modify
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Collections.emptyList();
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns field definitions for all base Ability fields (General, Target, Effects tabs).
|
||||
* Builds and returns all field definitions for this ability's GUI.
|
||||
* Base fields (General, Target, Effects) are added first, then
|
||||
* {@link #getAbilityDefinitions(List)} is called so subclasses can add
|
||||
* type-specific fields and modify any existing fields.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<FieldDef> getBaseFieldDefinitions() {
|
||||
public final List<FieldDef> getAllDefinitions() {
|
||||
List<FieldDef> defs = new ArrayList<>();
|
||||
|
||||
// General tab
|
||||
// ── General tab ──────────────────────────────────────────────
|
||||
defs.add(FieldDef.stringField("gui.name", this::getName, this::setName)
|
||||
.tab("General"));
|
||||
defs.add(FieldDef.row(
|
||||
@@ -366,7 +376,6 @@ public abstract class Ability implements IAbility {
|
||||
FieldDef.boolField("gui.enabled", this::isEnabled, this::setEnabled)
|
||||
).tab("General"));
|
||||
defs.add(FieldDef.section("ability.section.timing").tab("General"));
|
||||
// WindUp: 3 mutually exclusive entries based on animation/sync state
|
||||
defs.add(FieldDef.intField("ability.windUpTicks", this::getRawWindUpTicks, this::setWindUpTicks)
|
||||
.tab("General").range(0, 1000)
|
||||
.visibleWhen(() -> !hasWindUpAnimation()));
|
||||
@@ -399,24 +408,38 @@ public abstract class Ability implements IAbility {
|
||||
.range(0, 1000).visibleWhen(this::isInterruptible)
|
||||
).tab("General"));
|
||||
|
||||
// Target tab
|
||||
// ── Target tab ───────────────────────────────────────────────
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.intField("ability.minRange", () -> (int) getMinRange(), v -> setMinRange(v)).range(0, 100),
|
||||
FieldDef.intField("ability.maxRange", () -> (int) getMaxRange(), v -> setMaxRange(v)).range(1, 100)
|
||||
).tab("Target"));
|
||||
if (!isTargetingModeLocked()) {
|
||||
defs.add(FieldDef.enumField("ability.targetingMode", TargetingMode.class,
|
||||
this::getTargetingMode, this::setTargetingMode)
|
||||
.tab("Target").hover("ability.hover.targeting"));
|
||||
TargetingMode[] allowed = getAllowedTargetingModes();
|
||||
if (allowed != null && allowed.length > 0) {
|
||||
String[] allowedKeys = new String[allowed.length];
|
||||
for (int i = 0; i < allowed.length; i++) {
|
||||
allowedKeys[i] = allowed[i].name();
|
||||
}
|
||||
defs.add(FieldDef.stringEnumField("ability.targetingMode", allowedKeys,
|
||||
() -> this.getTargetingMode().name(),
|
||||
v -> {
|
||||
try { this.setTargetingMode(TargetingMode.valueOf(v)); }
|
||||
catch (Exception ignored) {}
|
||||
})
|
||||
.tab("Target").hover("ability.hover.targeting"));
|
||||
} else {
|
||||
defs.add(FieldDef.enumField("ability.targetingMode", TargetingMode.class,
|
||||
this::getTargetingMode, this::setTargetingMode)
|
||||
.tab("Target").hover("ability.hover.targeting"));
|
||||
}
|
||||
}
|
||||
|
||||
// Effects tab - Sounds
|
||||
// ── Effects tab ──────────────────────────────────────────────
|
||||
defs.add(FieldDef.section("ability.section.sounds").tab("Effects"));
|
||||
defs.add(FieldDef.soundSubGui("ability.windUpSound", this::getWindUpSound, this::setWindUpSound)
|
||||
.tab("Effects"));
|
||||
defs.add(FieldDef.soundSubGui("ability.activeSound", this::getActiveSound, this::setActiveSound)
|
||||
.tab("Effects"));
|
||||
// Effects tab - Animations
|
||||
defs.add(FieldDef.section("ability.section.animations").tab("Effects"));
|
||||
defs.add(FieldDef.animSubGui("ability.windUpAnimation",
|
||||
this::getWindUpAnimationId, this::setWindUpAnimationId,
|
||||
@@ -427,7 +450,6 @@ public abstract class Ability implements IAbility {
|
||||
this::getActiveAnimationName, this::setActiveAnimationName)
|
||||
.tab("Effects"));
|
||||
|
||||
// Effects tab - Telegraph
|
||||
TelegraphType tType = getTelegraphType();
|
||||
if (tType != null && tType != TelegraphType.NONE) {
|
||||
defs.add(FieldDef.section("ability.section.telegraph").tab("Effects")
|
||||
@@ -440,24 +462,17 @@ public abstract class Ability implements IAbility {
|
||||
.tab("Effects").visibleWhen(this::isShowTelegraph));
|
||||
}
|
||||
|
||||
return defs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ALL field definitions: base (General/Target/Effects) + type-specific (Type/Visual).
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final List<FieldDef> getAllFieldDefinitions() {
|
||||
List<FieldDef> all = new ArrayList<>(getBaseFieldDefinitions());
|
||||
List<FieldDef> typeDefs = getFieldDefinitions();
|
||||
// Default tab for type-specific fields that don't explicitly set one
|
||||
for (FieldDef def : typeDefs) {
|
||||
if (def.getTab() == null) {
|
||||
def.tab("Type");
|
||||
// ── Type-specific fields ─────────────────────────────────────
|
||||
int baseSize = defs.size();
|
||||
getAbilityDefinitions(defs);
|
||||
// Default tab for ability-added fields that don't specify one
|
||||
for (int i = baseSize; i < defs.size(); i++) {
|
||||
if (defs.get(i).getTab() == null) {
|
||||
defs.get(i).tab("Type");
|
||||
}
|
||||
}
|
||||
all.addAll(typeDefs);
|
||||
return all;
|
||||
|
||||
return defs;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -548,8 +563,12 @@ public abstract class Ability implements IAbility {
|
||||
instance.setEntityIdToFollow(caster.getEntityId());
|
||||
|
||||
// For LINE/CONE telegraphs: track target direction during windup
|
||||
// Only track if movement is NOT locked during windup (locked = NPC can't rotate)
|
||||
if ((telegraphType == TelegraphType.LINE || telegraphType == TelegraphType.CONE) && target != null) {
|
||||
instance.setTargetEntityId(target.getEntityId());
|
||||
if (!lockMovement.locksWindup()) {
|
||||
instance.setTargetEntityId(target.getEntityId());
|
||||
}
|
||||
// If windup is locked, yaw stays fixed at creation time
|
||||
}
|
||||
} else if (target != null) {
|
||||
// AOE_TARGET abilities: telegraph follows target during windup
|
||||
|
||||
@@ -364,6 +364,7 @@ public class AbilityController implements IAbilityHandler {
|
||||
registerType("cnpc:projectile", AbilityProjectile::new);
|
||||
registerType("cnpc:orb", AbilityOrb::new);
|
||||
registerType("cnpc:dual_orb", AbilityOrbDual::new);
|
||||
registerType("cnpc:orb_barrage", AbilityOrbBarrage::new);
|
||||
registerType("cnpc:dual_disc", AbilityDisc::new);
|
||||
registerType("cnpc:dual_disc", AbilityDiscDual::new);
|
||||
registerType("cnpc:laser_shot", AbilityLaserShot::new);
|
||||
|
||||
@@ -377,8 +377,8 @@ public class AbilityBeamDual extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -485,7 +485,7 @@ public class AbilityBeamDual extends Ability {
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -397,8 +397,8 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.chargeSpeed", this::getChargeSpeed, this::setChargeSpeed)
|
||||
@@ -408,6 +408,6 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
|
||||
FieldDef.floatField("ability.hitWidth", this::getHitWidth, this::setHitWidth)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -113,12 +113,16 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
|
||||
switch (sweepMode) {
|
||||
case SWIPE:
|
||||
float prevRotation = currentRotation;
|
||||
currentRotation += sweepSpeed;
|
||||
if (currentRotation > arcAngle / 2.0f) {
|
||||
signalCompletion(); // Swipe arc complete
|
||||
// Final sweep — check from prevRotation to end of arc
|
||||
performSweepDamageRange(caster, world, innerRadius, range, prevRotation, arcAngle / 2.0f);
|
||||
signalCompletion();
|
||||
return;
|
||||
}
|
||||
performSweepDamage(caster, world, innerRadius, range, currentRotation);
|
||||
currentRotation += sweepSpeed;
|
||||
// Check entities between previous and current sweep position
|
||||
performSweepDamageRange(caster, world, innerRadius, range, prevRotation, currentRotation);
|
||||
break;
|
||||
|
||||
case SPIN:
|
||||
@@ -126,15 +130,23 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
signalCompletion(); // Spin duration complete
|
||||
return;
|
||||
}
|
||||
float prevSpin = currentRotation;
|
||||
currentRotation = (currentRotation + sweepSpeed) % 360.0f;
|
||||
hitEntities.clear();
|
||||
performSweepDamage(caster, world, innerRadius, range, currentRotation);
|
||||
performSweepDamageRange(caster, world, innerRadius, range, prevSpin, currentRotation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void performSweepDamage(EntityLivingBase caster, World world, float minDist, float maxDist, float angleOffset) {
|
||||
float casterYaw = caster.rotationYaw + angleOffset;
|
||||
/**
|
||||
* Check for entities between two sweep angles, ensuring no gaps between ticks.
|
||||
* For SWIPE mode, this covers the continuous arc from startAngle to endAngle.
|
||||
*/
|
||||
private void performSweepDamageRange(EntityLivingBase caster, World world, float minDist, float maxDist,
|
||||
float startAngle, float endAngle) {
|
||||
// Calculate the angular range covered this tick
|
||||
float minAngle = Math.min(startAngle, endAngle);
|
||||
float maxAngle = Math.max(startAngle, endAngle);
|
||||
|
||||
AxisAlignedBB searchBox = AxisAlignedBB.getBoundingBox(
|
||||
caster.posX - maxDist, caster.posY - 1, caster.posZ - maxDist,
|
||||
@@ -155,7 +167,7 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
double dist = Math.sqrt(dx * dx + dz * dz);
|
||||
|
||||
if (dist < minDist || dist > maxDist) continue;
|
||||
if (!isInArc(dx, dz, casterYaw, arcAngle)) continue;
|
||||
if (!isInSweepRange(dx, dz, caster.rotationYaw, minAngle, maxAngle)) continue;
|
||||
|
||||
hitEntities.add(entity.getEntityId());
|
||||
|
||||
@@ -172,6 +184,16 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an entity falls within the angular range between two sweep positions.
|
||||
* This ensures entities at long range can't slip between tick-gaps.
|
||||
*/
|
||||
private boolean isInSweepRange(double dx, double dz, float casterYaw, float minAngle, float maxAngle) {
|
||||
double angleToEntity = Math.toDegrees(Math.atan2(-dx, dz));
|
||||
double entityRelative = normalizeAngle(angleToEntity - casterYaw);
|
||||
return entityRelative >= minAngle && entityRelative <= maxAngle;
|
||||
}
|
||||
|
||||
private boolean isInArc(double dx, double dz, float casterYaw, float arcWidth) {
|
||||
double angleToEntity = Math.toDegrees(Math.atan2(-dx, dz));
|
||||
double angleDiff = normalizeAngle(angleToEntity - casterYaw);
|
||||
@@ -316,8 +338,8 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("gui.range", this::getRange, this::setRange)
|
||||
@@ -337,6 +359,6 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
FieldDef.boolField("ability.piercing", this::isPiercing, this::setPiercing)
|
||||
.hover("ability.hover.piercing"),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,7 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
// Runtime state
|
||||
private transient Vec3 dashDirection;
|
||||
private transient double startX, startY, startZ;
|
||||
private transient double prevTickX, prevTickZ;
|
||||
private transient DashDirection chosenDirection;
|
||||
|
||||
public AbilityDash() {
|
||||
@@ -130,6 +131,8 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
startX = caster.posX;
|
||||
startY = caster.posY;
|
||||
startZ = caster.posZ;
|
||||
prevTickX = caster.posX;
|
||||
prevTickZ = caster.posZ;
|
||||
|
||||
// Choose random direction based on mode
|
||||
DashDirection[] directions = dashMode == DashMode.AGGRESSIVE
|
||||
@@ -163,6 +166,22 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
public void onActiveTick(EntityLivingBase caster, EntityLivingBase target, World world, int tick) {
|
||||
if (dashDirection == null) return;
|
||||
|
||||
// Stall detection: if entity hasn't moved since last tick, it's stuck against a wall
|
||||
if (tick > 1) {
|
||||
double movedThisTick = Math.sqrt(
|
||||
Math.pow(caster.posX - prevTickX, 2) +
|
||||
Math.pow(caster.posZ - prevTickZ, 2));
|
||||
if (movedThisTick < 0.01) {
|
||||
caster.motionX = 0;
|
||||
caster.motionZ = 0;
|
||||
caster.velocityChanged = true;
|
||||
signalCompletion();
|
||||
return;
|
||||
}
|
||||
}
|
||||
prevTickX = caster.posX;
|
||||
prevTickZ = caster.posZ;
|
||||
|
||||
// Calculate distance traveled
|
||||
double distanceTraveled = Math.sqrt(
|
||||
Math.pow(caster.posX - startX, 2) +
|
||||
@@ -351,14 +370,14 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.enumField("ability.dashMode", DashMode.class, this::getDashModeEnum, this::setDashModeEnum)
|
||||
.hover("ability.hover.dashMode"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.dashDistance", this::getDashDistance, this::setDashDistance),
|
||||
FieldDef.floatField("ability.dashSpeed", this::getDashSpeed, this::setDashSpeed)
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -273,8 +273,8 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -333,6 +333,6 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -386,8 +386,8 @@ public class AbilityDiscDual extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -495,7 +495,7 @@ public class AbilityDiscDual extends Ability {
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -276,8 +276,8 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -335,6 +335,6 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.UserType;
|
||||
import kamkeel.npcs.controllers.data.ability.*;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityGuard;
|
||||
@@ -18,10 +20,10 @@ import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Guard ability: Defensive stance that reduces incoming damage.
|
||||
@@ -29,23 +31,40 @@ import java.util.Random;
|
||||
*/
|
||||
public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
// Type-specific parameters
|
||||
private int durationTicks = 60;
|
||||
private float damageReduction = 0.5f;
|
||||
private boolean canCounter = false;
|
||||
private CounterType counterType = CounterType.FLAT;
|
||||
private AbilityGuard.CounterType counterType = AbilityGuard.CounterType.FLAT;
|
||||
private float counterValue = 6.0f;
|
||||
private float counterChance = 0.3f;
|
||||
private String counterSound = "random.wood_click";
|
||||
private String counterSound = "random.anvil_land";
|
||||
private boolean canCounter = false;
|
||||
private int counterWindow = 10;
|
||||
private int counterAnimationId = -1;
|
||||
private String counterAnimationName;
|
||||
|
||||
// Runtime state
|
||||
private transient EntityLivingBase lastAttacker;
|
||||
private transient boolean counterTriggered;
|
||||
private transient boolean counterEligible;
|
||||
private transient float lastDamageTaken;
|
||||
|
||||
public AbilityGuard() {
|
||||
this.typeId = "ability.cnpc.guard";
|
||||
this.name = "Guard";
|
||||
this.targetingMode = TargetingMode.SELF;
|
||||
this.lockMovement = LockMovementType.ACTIVE;
|
||||
this.cooldownTicks = 0;
|
||||
this.windUpTicks = 0;
|
||||
this.interruptible = false; // Hard to interrupt while guarding
|
||||
// No telegraph for guard - it's a defensive stance
|
||||
this.telegraphType = TelegraphType.NONE;
|
||||
this.showTelegraph = false;
|
||||
this.activeSound = "random.anvil_use";
|
||||
this.allowedBy = UserType.BOTH;
|
||||
|
||||
this.activeAnimationName = "Ability_Guard_Active";
|
||||
this.counterAnimationName = "Ability_Guard_Counter";
|
||||
}
|
||||
|
||||
public enum CounterType {
|
||||
FLAT,
|
||||
PERCENT;
|
||||
@@ -60,22 +79,6 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
}
|
||||
}
|
||||
|
||||
public AbilityGuard() {
|
||||
this.typeId = "ability.cnpc.guard";
|
||||
this.name = "Guard";
|
||||
this.targetingMode = TargetingMode.SELF;
|
||||
this.lockMovement = LockMovementType.ACTIVE;
|
||||
this.cooldownTicks = 0;
|
||||
this.windUpTicks = 10;
|
||||
this.interruptible = false; // Hard to interrupt while guarding
|
||||
// No telegraph for guard - it's a defensive stance
|
||||
this.telegraphType = TelegraphType.NONE;
|
||||
this.showTelegraph = false;
|
||||
this.windUpSound = "random.anvil_use";
|
||||
this.activeSound = "random.anvil_land";
|
||||
this.allowedBy = UserType.NPC_ONLY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -91,41 +94,56 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
lastAttacker = null;
|
||||
counterTriggered = false;
|
||||
lastDamageTaken = 0.0f;
|
||||
counterEligible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActiveTick(EntityLivingBase caster, EntityLivingBase target, World world, int tick) {
|
||||
// Counter attack logic if triggered
|
||||
if (canCounter && counterTriggered && lastAttacker != null && !world.isRemote) {
|
||||
if (canCounter && counterEligible && counterTriggered && lastAttacker != null && !world.isRemote) {
|
||||
performCounter(caster, world);
|
||||
}
|
||||
|
||||
// Check if guard duration has ended
|
||||
if (tick > counterWindow && counterEligible) {
|
||||
counterEligible = false;
|
||||
}
|
||||
|
||||
if (tick >= durationTicks) {
|
||||
signalCompletion();
|
||||
}
|
||||
|
||||
// Just enough to see the counter animation
|
||||
if (counterTriggered && tick >= counterWindow + 10) {
|
||||
signalCompletion();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called externally when the caster takes damage while guarding.
|
||||
* This should be called from the damage handling code.
|
||||
*
|
||||
* @param attacker The entity that attacked
|
||||
* @param damage The damage amount (after reduction)
|
||||
*/
|
||||
public void onDamageTaken(EntityLivingBase caster, EntityLivingBase attacker, DamageSource source, float damage) {
|
||||
if (!canCounter || attacker == null) return;
|
||||
if (!isDirectHit(source)) return;
|
||||
if (RANDOM.nextFloat() >= counterChance) return;
|
||||
if (!isGuarding() || attacker == null) return;
|
||||
|
||||
lastAttacker = attacker;
|
||||
lastDamageTaken = damage;
|
||||
counterTriggered = true;
|
||||
// Counter will be performed in onActiveTick - don't self-interrupt
|
||||
|
||||
float reduction = ValueUtil.clamp(getDamageReductionFactor(), 0, damage);
|
||||
float newHealth = ValueUtil.clamp(caster.getHealth() + reduction, 0, caster.getMaxHealth());
|
||||
|
||||
caster.setHealth(newHealth);
|
||||
|
||||
if (!canCounter || !counterEligible || counterTriggered || !isDirectHit(source)) {
|
||||
caster.setHealth(newHealth);
|
||||
} else {
|
||||
caster.setHealth(ValueUtil.clamp(caster.getHealth() + damage, 0, caster.getMaxHealth()));
|
||||
counterTriggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDirectHit(DamageSource source) {
|
||||
if (source == null) return false;
|
||||
if (source.isMagicDamage() || source.isFireDamage() || source.isExplosion()) return false;
|
||||
return source.getEntity() instanceof EntityLivingBase;
|
||||
}
|
||||
|
||||
private void performCounter(EntityLivingBase caster, World world) {
|
||||
float counterDamage = counterType == CounterType.PERCENT
|
||||
float counterDamage = counterType == AbilityGuard.CounterType.PERCENT
|
||||
? lastDamageTaken * (counterValue / 100.0f)
|
||||
: counterValue;
|
||||
|
||||
@@ -135,18 +153,32 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
}
|
||||
// Use shared animation utility - only available for NPCs
|
||||
if (caster instanceof EntityNPCInterface) {
|
||||
((EntityNPCInterface) caster).abilities.playAbilityAnimation(counterAnimationId);
|
||||
if (getCounterAnimation() instanceof IAnimation) {
|
||||
((EntityNPCInterface) caster).abilities.playAbilityAnimation((Animation) getCounterAnimation());
|
||||
}
|
||||
} else if (caster instanceof EntityPlayer) {
|
||||
if (getCounterAnimation() instanceof IAnimation) {
|
||||
PlayerData.get((EntityPlayer) caster).abilityData.playAbilityAnimation((Animation) getCounterAnimation());
|
||||
}
|
||||
}
|
||||
|
||||
counterTriggered = false;
|
||||
counterEligible = false;
|
||||
lastAttacker = null;
|
||||
lastDamageTaken = 0.0f;
|
||||
}
|
||||
|
||||
private boolean isDirectHit(DamageSource source) {
|
||||
if (source == null) return false;
|
||||
if (source.isMagicDamage() || source.isFireDamage() || source.isExplosion()) return false;
|
||||
return source.getEntity() instanceof EntityLivingBase;
|
||||
private IAnimation getCounterAnimation() {
|
||||
if (AnimationController.Instance == null) return null;
|
||||
|
||||
if (counterAnimationId > 0) {
|
||||
return AnimationController.Instance.get(counterAnimationId);
|
||||
}
|
||||
|
||||
if (!counterAnimationName.isEmpty()) {
|
||||
return AnimationController.Instance.get(counterAnimationName, true);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +186,7 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
* Returns 0.5 for 50% reduction.
|
||||
*/
|
||||
public float getDamageReductionFactor() {
|
||||
if (isExecuting() && getPhase() == kamkeel.npcs.controllers.data.ability.AbilityPhase.ACTIVE) {
|
||||
if (isExecuting() && getPhase() == AbilityPhase.ACTIVE) {
|
||||
return damageReduction;
|
||||
}
|
||||
return 0.0f;
|
||||
@@ -164,7 +196,7 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
* Check if the caster is currently in guard stance.
|
||||
*/
|
||||
public boolean isGuarding() {
|
||||
return isExecuting() && getPhase() == kamkeel.npcs.controllers.data.ability.AbilityPhase.ACTIVE;
|
||||
return isExecuting() && getPhase() == AbilityPhase.ACTIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,11 +217,12 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
nbt.setInteger("durationTicks", durationTicks);
|
||||
nbt.setFloat("damageReduction", damageReduction);
|
||||
nbt.setBoolean("canCounter", canCounter);
|
||||
nbt.setInteger("counterWindow", counterWindow);
|
||||
nbt.setString("counterType", counterType.name());
|
||||
nbt.setFloat("counterValue", counterValue);
|
||||
nbt.setFloat("counterChance", counterChance);
|
||||
nbt.setString("counterSound", counterSound);
|
||||
nbt.setInteger("counterAnimationId", counterAnimationId);
|
||||
nbt.setString("counterAnimationName", counterAnimationName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,6 +230,7 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
this.durationTicks = nbt.hasKey("durationTicks") ? nbt.getInteger("durationTicks") : 60;
|
||||
this.damageReduction = nbt.hasKey("damageReduction") ? nbt.getFloat("damageReduction") : 0.5f;
|
||||
this.canCounter = nbt.hasKey("canCounter") && nbt.getBoolean("canCounter");
|
||||
this.counterWindow = nbt.hasKey("counterWindow") ? nbt.getInteger("counterWindow") : 10;
|
||||
try {
|
||||
this.counterType = CounterType.valueOf(nbt.getString("counterType"));
|
||||
} catch (Exception e) {
|
||||
@@ -209,9 +243,11 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
} else {
|
||||
this.counterValue = 6.0f;
|
||||
}
|
||||
this.counterChance = nbt.hasKey("counterChance") ? nbt.getFloat("counterChance") : 0.3f;
|
||||
this.counterSound = nbt.hasKey("counterSound") ? nbt.getString("counterSound") : "random.wood_click";
|
||||
this.counterAnimationId = nbt.hasKey("counterAnimationId") ? nbt.getInteger("counterAnimationId") : -1;
|
||||
this.counterAnimationName = nbt.hasKey("counterAnimationName") ?
|
||||
nbt.getString("counterAnimationName") :
|
||||
"Ability_Guard_Counter";
|
||||
}
|
||||
|
||||
// Getters & Setters
|
||||
@@ -223,17 +259,26 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
this.durationTicks = Math.max(1, durationTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCounterWindow() {
|
||||
return this.counterWindow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCounterWindow(int ticks) {
|
||||
this.counterWindow = Math.min(durationTicks, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageReduction() {
|
||||
return damageReduction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamageReduction(float damageReduction) {
|
||||
this.damageReduction = damageReduction;
|
||||
}
|
||||
|
||||
public boolean isCanCounter() {
|
||||
return canCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCounter() {
|
||||
@@ -271,14 +316,6 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
this.counterValue = counterValue;
|
||||
}
|
||||
|
||||
public float getCounterChance() {
|
||||
return counterChance;
|
||||
}
|
||||
|
||||
public void setCounterChance(float counterChance) {
|
||||
this.counterChance = counterChance;
|
||||
}
|
||||
|
||||
public String getCounterSound() {
|
||||
return counterSound;
|
||||
}
|
||||
@@ -295,27 +332,47 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
this.counterAnimationId = counterAnimationId;
|
||||
}
|
||||
|
||||
public String getCounterAnimationName() {
|
||||
return counterAnimationName;
|
||||
}
|
||||
|
||||
public void setCounterAnimationName(String name) {
|
||||
this.counterAnimationName = name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks).range(1, 1000),
|
||||
FieldDef.floatField("ability.damageReduction", this::getDamageReduction, this::setDamageReduction),
|
||||
FieldDef.section("ability.section.counter"),
|
||||
FieldDef.boolField("gui.enabled", this::isCanCounter, this::setCanCounter).hover("ability.hover.canCounter"),
|
||||
FieldDef.boolField("gui.enabled", this::canCounter, this::setCanCounter).hover("ability.hover.canCounter"),
|
||||
FieldDef.enumField("gui.type", CounterType.class, this::getCounterTypeEnum, this::setCounterTypeEnum)
|
||||
.hover("ability.hover.counterType").visibleWhen(this::isCanCounter),
|
||||
.hover("ability.hover.counterType").visibleWhen(this::canCounter),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.value", this::getCounterValue, this::setCounterValue)
|
||||
.visibleWhen(this::isCanCounter),
|
||||
FieldDef.floatField("gui.chance", this::getCounterChance, this::setCounterChance)
|
||||
.visibleWhen(this::isCanCounter)
|
||||
.visibleWhen(this::canCounter),
|
||||
FieldDef.intField("ability.counterWindow", this::getCounterWindow, this::setCounterWindow)
|
||||
.visibleWhen(this::canCounter)
|
||||
),
|
||||
FieldDef.stringField("gui.sound", this::getCounterSound, this::setCounterSound)
|
||||
.visibleWhen(this::isCanCounter),
|
||||
FieldDef.intField("gui.animation", this::getCounterAnimationId, this::setCounterAnimationId)
|
||||
.visibleWhen(this::isCanCounter),
|
||||
.visibleWhen(this::canCounter),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
|
||||
));
|
||||
|
||||
FieldDef.insertAfter(defs, "ability.activeSound",
|
||||
FieldDef.soundSubGui("ability.counterSound", this::getCounterSound, this::setCounterSound)
|
||||
.tab("Effects").visibleWhen(this::canCounter));
|
||||
|
||||
FieldDef.insertAfter(defs, "ability.activeAnimation",
|
||||
FieldDef.animSubGui("ability.counterAnimation",
|
||||
this::getCounterAnimationId, this::setCounterAnimationId,
|
||||
this::getCounterAnimationName, this::setCounterAnimationName)
|
||||
.tab("Effects").visibleWhen(this::canCounter));
|
||||
|
||||
FieldDef.modifyVisibility(defs, "ability.windUpAnimation", () -> false);
|
||||
FieldDef.modifyVisibility(defs, "ability.windUpSound", () -> false);
|
||||
}
|
||||
}
|
||||
@@ -630,8 +630,8 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks).range(1, 2000),
|
||||
FieldDef.enumField("ability.shape", HazardShape.class, this::getShapeEnum, this::setShapeEnum)
|
||||
.hover("ability.hover.shape"),
|
||||
@@ -656,6 +656,6 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
FieldDef.boolField("ability.affectsCaster", this::isAffectsCaster, this::setAffectsCaster)
|
||||
.hover("ability.hover.affectsCaster"),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -281,8 +281,8 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.boolField("ability.instantHeal", this::isInstantHeal, this::setInstantHeal)
|
||||
.hover("ability.hover.instant"),
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||
@@ -299,6 +299,6 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
|
||||
FieldDef.boolField("ability.healAllies", this::isHealAllies, this::setHealAllies)
|
||||
.hover("ability.hover.healAllies")
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -6,37 +6,40 @@ import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityHeavyHit;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Heavy Hit ability: Single-target melee attack with optional stun.
|
||||
* Deals high damage to one target and can stun them.
|
||||
* Heavy Hit ability: AOE rectangle melee attack in front of the caster.
|
||||
* Deals high damage to all entities within a rectangular zone and can apply effects.
|
||||
* Has a LINE telegraph showing the hit area during windup, making it dodgeable.
|
||||
*/
|
||||
public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
|
||||
private float damage = 8.0f;
|
||||
private float knockback = 2.0f;
|
||||
private float hitLength = 4.0f; // How far in front of the caster the hit reaches
|
||||
private float hitWidth = 3.0f; // How wide to each side (total width = hitWidth * 2)
|
||||
|
||||
public AbilityHeavyHit() {
|
||||
this.typeId = "ability.cnpc.heavy_hit";
|
||||
this.name = "Heavy Hit";
|
||||
this.targetingMode = TargetingMode.AGGRO_TARGET;
|
||||
this.maxRange = 3.0f;
|
||||
this.targetingMode = TargetingMode.AOE_SELF;
|
||||
this.maxRange = 5.0f;
|
||||
this.minRange = 0.0f;
|
||||
this.lockMovement = LockMovementType.NO;
|
||||
this.lockMovement = LockMovementType.WINDUP;
|
||||
this.cooldownTicks = 0;
|
||||
this.windUpTicks = 30;
|
||||
this.telegraphType = TelegraphType.POINT;
|
||||
this.showTelegraph = false;
|
||||
this.telegraphType = TelegraphType.LINE;
|
||||
this.showTelegraph = true;
|
||||
this.windUpSound = "random.anvil_use";
|
||||
this.activeSound = "random.anvil_land";
|
||||
this.windUpAnimationName = "Ability_HeavyHit_Windup";
|
||||
@@ -50,22 +53,66 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
|
||||
@Override
|
||||
public TargetingMode[] getAllowedTargetingModes() {
|
||||
return new TargetingMode[]{TargetingMode.AGGRO_TARGET};
|
||||
return new TargetingMode[]{TargetingMode.AOE_SELF};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTelegraphLength() {
|
||||
return hitLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTelegraphWidth() {
|
||||
return hitWidth * 2.0f; // Total width (hitWidth is distance to each side)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecute(EntityLivingBase caster, EntityLivingBase target, World world) {
|
||||
if (world.isRemote || target == null) {
|
||||
if (world.isRemote) {
|
||||
signalCompletion();
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply damage with scripted event support
|
||||
boolean wasHit = applyAbilityDamage(caster, target, damage, knockback);
|
||||
// Calculate forward and right vectors from caster yaw
|
||||
float yawRad = (float) Math.toRadians(caster.rotationYaw);
|
||||
double forwardX = -Math.sin(yawRad);
|
||||
double forwardZ = Math.cos(yawRad);
|
||||
double rightX = forwardZ; // perpendicular right
|
||||
double rightZ = -forwardX;
|
||||
|
||||
// Apply effects if hit wasn't cancelled
|
||||
if (wasHit) {
|
||||
applyEffects(target);
|
||||
// Search area: AABB that encompasses the rectangle
|
||||
float searchDist = Math.max(hitLength, hitWidth) + 1.0f;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(
|
||||
caster, caster.boundingBox.expand(searchDist, 2, searchDist));
|
||||
|
||||
boolean anyHit = false;
|
||||
for (Entity entity : entities) {
|
||||
if (!(entity instanceof EntityLivingBase) || entity == caster) continue;
|
||||
EntityLivingBase livingTarget = (EntityLivingBase) entity;
|
||||
|
||||
double dx = livingTarget.posX - caster.posX;
|
||||
double dz = livingTarget.posZ - caster.posZ;
|
||||
|
||||
// Project onto forward direction (must be in front, within hitLength)
|
||||
double forwardDist = dx * forwardX + dz * forwardZ;
|
||||
if (forwardDist < 0 || forwardDist > hitLength) continue;
|
||||
|
||||
// Project onto right direction (must be within hitWidth to each side)
|
||||
double sideDist = dx * rightX + dz * rightZ;
|
||||
if (Math.abs(sideDist) > hitWidth) continue;
|
||||
|
||||
// Entity is within the rectangle - apply damage
|
||||
boolean wasHit = applyAbilityDamage(caster, livingTarget, damage, knockback);
|
||||
if (wasHit) {
|
||||
applyEffects(livingTarget);
|
||||
anyHit = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Play hit sound even if nothing was hit (the attack still happens)
|
||||
if (!anyHit) {
|
||||
world.playSoundAtEntity(caster, "random.anvil_land", 0.5f, 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +127,16 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
public void writeTypeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("damage", damage);
|
||||
nbt.setFloat("knockback", knockback);
|
||||
nbt.setFloat("hitLength", hitLength);
|
||||
nbt.setFloat("hitWidth", hitWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readTypeNBT(NBTTagCompound nbt) {
|
||||
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 8.0f;
|
||||
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 2.0f;
|
||||
this.hitLength = nbt.hasKey("hitLength") ? nbt.getFloat("hitLength") : 4.0f;
|
||||
this.hitWidth = nbt.hasKey("hitWidth") ? nbt.getFloat("hitWidth") : 3.0f;
|
||||
}
|
||||
|
||||
// Getters & Setters
|
||||
@@ -105,15 +156,36 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
this.knockback = knockback;
|
||||
}
|
||||
|
||||
public float getHitLength() {
|
||||
return hitLength;
|
||||
}
|
||||
|
||||
public void setHitLength(float hitLength) {
|
||||
this.hitLength = hitLength;
|
||||
}
|
||||
|
||||
public float getHitWidth() {
|
||||
return hitWidth;
|
||||
}
|
||||
|
||||
public void setHitWidth(float hitWidth) {
|
||||
this.hitWidth = hitWidth;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
),
|
||||
FieldDef.section("ability.section.hitZone"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.hitLength", this::getHitLength, this::setHitLength),
|
||||
FieldDef.floatField("ability.hitWidth", this::getHitWidth, this::setHitWidth)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -247,8 +247,8 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.row(
|
||||
@@ -290,6 +290,6 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -412,8 +412,8 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -459,6 +459,6 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import kamkeel.npcs.util.AnchorPointHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AbilityOrbBarrage extends Ability {
|
||||
|
||||
// Ability-specific properties
|
||||
private float orbSize = 0.5f;
|
||||
private int orbAmount = 16;
|
||||
private int firingSpeed = 2;
|
||||
private boolean dualCharging = true;
|
||||
|
||||
// Data classes for energy properties
|
||||
private final EnergyColorData colorData = new EnergyColorData();
|
||||
private final EnergyCombatData combatData = new EnergyCombatData(4.0f, 0.0f, 0.0f, false, 1.5f, 0.5f);
|
||||
private final EnergyHomingData homingData = new EnergyHomingData();
|
||||
private final EnergyLightningData lightningData = new EnergyLightningData();
|
||||
private final EnergyLifespanData lifespanData = new EnergyLifespanData();
|
||||
private final EnergyAnchorData[] anchorData = new EnergyAnchorData[]{
|
||||
new EnergyAnchorData(AnchorPoint.RIGHT_HAND), new EnergyAnchorData(AnchorPoint.LEFT_HAND)
|
||||
};
|
||||
|
||||
// Array to store entities
|
||||
private transient List<EntityAbilityOrb> orbEntities = new ArrayList<>();
|
||||
private transient EntityAbilityOrb[] chargingEntities = null;
|
||||
|
||||
// Field to keep track of the currently firing orb
|
||||
private int currentOrb = 0;
|
||||
|
||||
public AbilityOrbBarrage() {
|
||||
this.typeId = "ability.cnpc.orb_barrage";
|
||||
this.name = "Orb Barrage";
|
||||
this.targetingMode = TargetingMode.AGGRO_TARGET;
|
||||
this.maxRange = 75.0f;
|
||||
this.minRange = 5.0f;
|
||||
this.cooldownTicks = 0;
|
||||
this.windUpTicks = 30;
|
||||
this.lockMovement = LockMovementType.WINDUP;
|
||||
this.telegraphType = TelegraphType.CIRCLE;
|
||||
this.showTelegraph = true;
|
||||
// Default built-in animation
|
||||
this.windUpAnimationName = "Ability_BeamDual_Windup";
|
||||
this.activeAnimationName = "Ability_BeamDual_Active";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
// return new SubGuiAbilityOrbBarrage(this, callback);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetingMode[] getAllowedTargetingModes() {
|
||||
return new TargetingMode[]{TargetingMode.AGGRO_TARGET};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecute(EntityLivingBase caster, EntityLivingBase target, World world) {
|
||||
if (world.isRemote) {
|
||||
signalCompletion();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < chargingEntities.length; i++) {
|
||||
EntityAbilityOrb orbEntity = chargingEntities[i];
|
||||
|
||||
if (orbEntity != null && !orbEntity.isDead) {
|
||||
orbEntity.setDead();
|
||||
}
|
||||
|
||||
chargingEntities[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindUpTick(EntityLivingBase caster, EntityLivingBase target, World world, int tick) {
|
||||
if (world.isRemote) return;
|
||||
|
||||
// Spawn orb in charging mode on first tick of windup
|
||||
if (tick == 1) {
|
||||
// Create orb in charging mode - follows caster based on anchor point during windup
|
||||
|
||||
if (dualCharging) {
|
||||
chargingEntities = new EntityAbilityOrb[2];
|
||||
} else {
|
||||
chargingEntities = new EntityAbilityOrb[1];
|
||||
}
|
||||
|
||||
for (int i = 0; i < chargingEntities.length; i++) {
|
||||
Vec3 spawnPos = AnchorPointHelper.calculateAnchorPosition(caster, anchorData[i]);
|
||||
|
||||
EntityAbilityOrb orbEntity = new EntityAbilityOrb(
|
||||
world, caster, target,
|
||||
spawnPos.xCoord, spawnPos.yCoord, spawnPos.zCoord, orbSize,
|
||||
colorData, combatData, homingData, lightningData, lifespanData
|
||||
);
|
||||
|
||||
orbEntity.setupCharging(anchorData[i], windUpTicks);
|
||||
|
||||
chargingEntities[i] = orbEntity;
|
||||
world.spawnEntityInWorld(orbEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActiveTick(EntityLivingBase caster, EntityLivingBase target, World world, int tick) {
|
||||
if (!orbEntities.isEmpty()) {
|
||||
boolean allDead = true;
|
||||
|
||||
for (EntityAbilityOrb orbEntity : orbEntities) {
|
||||
if (orbEntity != null && !orbEntity.isDead) {
|
||||
allDead = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (allDead && currentOrb >= orbAmount) {
|
||||
signalCompletion();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentOrb >= orbAmount) {
|
||||
return;
|
||||
}
|
||||
|
||||
int ticksPerOrb = Math.max(1, 20 / firingSpeed);
|
||||
|
||||
if (tick % ticksPerOrb != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnergyAnchorData anchor;
|
||||
|
||||
if (dualCharging) {
|
||||
anchor = anchorData[currentOrb % 2];
|
||||
} else {
|
||||
anchor = anchorData[0];
|
||||
}
|
||||
|
||||
Vec3 spawnPos = AnchorPointHelper.calculateAnchorPosition(caster, anchor);
|
||||
|
||||
EntityAbilityOrb orb = new EntityAbilityOrb(
|
||||
world, caster, target, spawnPos.xCoord, spawnPos.yCoord, spawnPos.zCoord,
|
||||
orbSize, colorData, combatData, homingData, lightningData, lifespanData
|
||||
);
|
||||
|
||||
world.spawnEntityInWorld(orb);
|
||||
|
||||
orbEntities.add(orb);
|
||||
currentOrb++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
currentOrb = 0;
|
||||
|
||||
if (orbEntities != null && !orbEntities.isEmpty()) {
|
||||
for (EntityAbilityOrb orbEntity : orbEntities) {
|
||||
if (orbEntity != null && !orbEntity.isDead) {
|
||||
orbEntity.setDead();
|
||||
}
|
||||
}
|
||||
orbEntities.clear();
|
||||
}
|
||||
|
||||
if (chargingEntities != null) {
|
||||
for (int i = 0; i < chargingEntities.length; i++) {
|
||||
if (chargingEntities[i] != null && !chargingEntities[i].isDead) {
|
||||
chargingEntities[i].setDead();
|
||||
}
|
||||
chargingEntities[i] = null;
|
||||
}
|
||||
chargingEntities = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TelegraphInstance createTelegraph(EntityLivingBase caster, EntityLivingBase target) {
|
||||
if (!showTelegraph || telegraphType == TelegraphType.NONE || target == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create small circle telegraph at target position
|
||||
Telegraph telegraph = Telegraph.circle(orbSize * 1.5f);
|
||||
telegraph.setDurationTicks(windUpTicks);
|
||||
telegraph.setColor(windUpColor);
|
||||
telegraph.setWarningColor(activeColor);
|
||||
telegraph.setWarningStartTick(Math.max(5, windUpTicks / 4));
|
||||
telegraph.setHeightOffset(telegraphHeightOffset);
|
||||
|
||||
// Position at target and follow target during windup
|
||||
TelegraphInstance instance = new TelegraphInstance(telegraph, target.posX, target.posY, target.posZ, caster.rotationYaw);
|
||||
instance.setCasterEntityId(caster.getEntityId());
|
||||
instance.setEntityIdToFollow(target.getEntityId());
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTelegraphRadius() {
|
||||
return orbSize * 1.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTypeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("orbSize", orbSize);
|
||||
nbt.setInteger("orbAmount", orbAmount);
|
||||
nbt.setInteger("firingSpeed", firingSpeed);
|
||||
nbt.setBoolean("dualCharging", dualCharging);
|
||||
colorData.writeNBT(nbt);
|
||||
combatData.writeNBT(nbt);
|
||||
homingData.writeNBT(nbt);
|
||||
lightningData.writeNBT(nbt);
|
||||
lifespanData.writeNBT(nbt);
|
||||
|
||||
for (int i = 0; i < anchorData.length; i++) {
|
||||
NBTTagCompound comp = new NBTTagCompound();
|
||||
anchorData[i].writeNBT(comp);
|
||||
nbt.setTag("Anchor_" + i, comp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readTypeNBT(NBTTagCompound nbt) {
|
||||
this.orbSize = nbt.hasKey("orbSize") ? nbt.getFloat("orbSize") : 1.0f;
|
||||
this.orbAmount = nbt.hasKey("orbAmount") ? nbt.getInteger("orbAmount") : 16;
|
||||
this.firingSpeed = nbt.hasKey("firingSpeed") ? nbt.getInteger("firingSpeed") : 2;
|
||||
this.dualCharging = !nbt.hasKey("dualCharging") || nbt.getBoolean("dualCharging");
|
||||
colorData.readNBT(nbt);
|
||||
combatData.readNBT(nbt);
|
||||
homingData.readNBT(nbt);
|
||||
lightningData.readNBT(nbt);
|
||||
lifespanData.readNBT(nbt);
|
||||
|
||||
for (int i = 0; i < anchorData.length; i++) {
|
||||
if (nbt.hasKey("Anchor_" + i, Constants.NBT.TAG_COMPOUND)) {
|
||||
anchorData[i].readNBT(nbt.getCompoundTag("Anchor_" + i));
|
||||
} else {
|
||||
anchorData[i] = new EnergyAnchorData(i == 0 ? AnchorPoint.RIGHT_HAND : AnchorPoint.LEFT_HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Getters & Setters
|
||||
public float getOrbSpeed() {
|
||||
return homingData.speed;
|
||||
}
|
||||
|
||||
public void setOrbSpeed(float orbSpeed) {
|
||||
homingData.speed = orbSpeed;
|
||||
}
|
||||
|
||||
public float getOrbSize() {
|
||||
return orbSize;
|
||||
}
|
||||
|
||||
public void setOrbSize(float orbSize) {
|
||||
this.orbSize = orbSize;
|
||||
}
|
||||
|
||||
public int getOrbAmount() { return orbAmount; }
|
||||
|
||||
public void setOrbAmount(int orbAmount) { this.orbAmount = orbAmount; }
|
||||
|
||||
public int getFiringSpeed() { return firingSpeed; }
|
||||
|
||||
public void setFiringSpeed(int firingSpeed) { this.firingSpeed = firingSpeed; }
|
||||
|
||||
public boolean isDualCharging() { return dualCharging; }
|
||||
|
||||
public void setDualCharging(boolean dualCharging) { this.dualCharging = dualCharging; }
|
||||
|
||||
public float getMaxDistance() {
|
||||
return lifespanData.maxDistance;
|
||||
}
|
||||
|
||||
public void setMaxDistance(float maxDistance) {
|
||||
lifespanData.maxDistance = maxDistance;
|
||||
}
|
||||
|
||||
public int getMaxLifetime() {
|
||||
return lifespanData.maxLifetime;
|
||||
}
|
||||
|
||||
public void setMaxLifetime(int maxLifetime) {
|
||||
lifespanData.maxLifetime = maxLifetime;
|
||||
}
|
||||
|
||||
public float getDamage() {
|
||||
return combatData.damage;
|
||||
}
|
||||
|
||||
public void setDamage(float damage) {
|
||||
combatData.damage = damage;
|
||||
}
|
||||
|
||||
public float getKnockback() {
|
||||
return combatData.knockback;
|
||||
}
|
||||
|
||||
public void setKnockback(float knockback) {
|
||||
combatData.knockback = knockback;
|
||||
}
|
||||
|
||||
public float getKnockbackUp() {
|
||||
return combatData.knockbackUp;
|
||||
}
|
||||
|
||||
public void setKnockbackUp(float knockbackUp) {
|
||||
combatData.knockbackUp = knockbackUp;
|
||||
}
|
||||
|
||||
public boolean isHoming() {
|
||||
return homingData.homing;
|
||||
}
|
||||
|
||||
public void setHoming(boolean homing) {
|
||||
homingData.homing = homing;
|
||||
}
|
||||
|
||||
public float getHomingStrength() {
|
||||
return homingData.homingStrength;
|
||||
}
|
||||
|
||||
public void setHomingStrength(float homingStrength) {
|
||||
homingData.homingStrength = homingStrength;
|
||||
}
|
||||
|
||||
public float getHomingRange() {
|
||||
return homingData.homingRange;
|
||||
}
|
||||
|
||||
public void setHomingRange(float homingRange) {
|
||||
homingData.homingRange = homingRange;
|
||||
}
|
||||
|
||||
public boolean isExplosive() {
|
||||
return combatData.explosive;
|
||||
}
|
||||
|
||||
public void setExplosive(boolean explosive) {
|
||||
combatData.explosive = explosive;
|
||||
}
|
||||
|
||||
public float getExplosionRadius() {
|
||||
return combatData.explosionRadius;
|
||||
}
|
||||
|
||||
public void setExplosionRadius(float explosionRadius) {
|
||||
combatData.explosionRadius = explosionRadius;
|
||||
}
|
||||
|
||||
public float getExplosionDamageFalloff() {
|
||||
return combatData.explosionDamageFalloff;
|
||||
}
|
||||
|
||||
public void setExplosionDamageFalloff(float explosionDamageFalloff) {
|
||||
combatData.explosionDamageFalloff = explosionDamageFalloff;
|
||||
}
|
||||
|
||||
public int getInnerColor() {
|
||||
return colorData.innerColor;
|
||||
}
|
||||
|
||||
public void setInnerColor(int innerColor) {
|
||||
colorData.innerColor = innerColor;
|
||||
}
|
||||
|
||||
public int getOuterColor() {
|
||||
return colorData.outerColor;
|
||||
}
|
||||
|
||||
public void setOuterColor(int outerColor) {
|
||||
colorData.outerColor = outerColor;
|
||||
}
|
||||
|
||||
public float getOuterColorWidth() {
|
||||
return colorData.outerColorWidth;
|
||||
}
|
||||
|
||||
public void setOuterColorWidth(float outerColorWidth) {
|
||||
colorData.outerColorWidth = outerColorWidth;
|
||||
}
|
||||
|
||||
public float getOuterColorAlpha() {
|
||||
return colorData.outerColorAlpha;
|
||||
}
|
||||
|
||||
public void setOuterColorAlpha(float outerColorAlpha) {
|
||||
colorData.outerColorAlpha = outerColorAlpha;
|
||||
}
|
||||
|
||||
public boolean isOuterColorEnabled() {
|
||||
return colorData.outerColorEnabled;
|
||||
}
|
||||
|
||||
public void setOuterColorEnabled(boolean outerColorEnabled) {
|
||||
colorData.outerColorEnabled = outerColorEnabled;
|
||||
}
|
||||
|
||||
public float getRotationSpeed() {
|
||||
return colorData.rotationSpeed;
|
||||
}
|
||||
|
||||
public void setRotationSpeed(float rotationSpeed) {
|
||||
colorData.rotationSpeed = rotationSpeed;
|
||||
}
|
||||
|
||||
public boolean hasLightningEffect() {
|
||||
return lightningData.lightningEffect;
|
||||
}
|
||||
|
||||
public void setLightningEffect(boolean lightningEffect) {
|
||||
lightningData.lightningEffect = lightningEffect;
|
||||
}
|
||||
|
||||
public float getLightningDensity() {
|
||||
return lightningData.lightningDensity;
|
||||
}
|
||||
|
||||
public void setLightningDensity(float lightningDensity) {
|
||||
lightningData.lightningDensity = lightningDensity;
|
||||
}
|
||||
|
||||
public float getLightningRadius() {
|
||||
return lightningData.lightningRadius;
|
||||
}
|
||||
|
||||
public void setLightningRadius(float lightningRadius) {
|
||||
lightningData.lightningRadius = lightningRadius;
|
||||
}
|
||||
|
||||
public int getLightningFadeTime() {
|
||||
return lightningData.lightningFadeTime;
|
||||
}
|
||||
|
||||
public void setLightningFadeTime(int lightningFadeTime) {
|
||||
lightningData.lightningFadeTime = lightningFadeTime;
|
||||
}
|
||||
|
||||
private EnergyAnchorData getAnchorData(int orb) {
|
||||
orb = ValueUtil.clamp(orb, 0, 1);
|
||||
return anchorData[orb];
|
||||
}
|
||||
|
||||
public AnchorPoint getAnchorPointEnum(int orb) { return getAnchorData(orb).anchorPoint; }
|
||||
public void setAnchorPointEnum(int orb, AnchorPoint anchorPoint) { getAnchorData(orb).anchorPoint = anchorPoint; }
|
||||
public float getAnchorOffsetX(int orb) { return getAnchorData(orb).anchorOffsetX; }
|
||||
public void setAnchorOffsetX(int orb, float x) { getAnchorData(orb).anchorOffsetX = x; }
|
||||
public float getAnchorOffsetY(int orb) { return getAnchorData(orb).anchorOffsetY; }
|
||||
public void setAnchorOffsetY(int orb, float y) { getAnchorData(orb).anchorOffsetY = y; }
|
||||
public float getAnchorOffsetZ(int orb) { return getAnchorData(orb).anchorOffsetZ; }
|
||||
public void setAnchorOffsetZ(int orb, float z) { getAnchorData(orb).anchorOffsetZ = z; }
|
||||
|
||||
public AnchorPoint getAnchorPointEnum() { return getAnchorPointEnum(0); }
|
||||
public void setAnchorPointEnum(AnchorPoint anchorPoint) { setAnchorPointEnum(0, anchorPoint); }
|
||||
public float getAnchorOffsetX() { return getAnchorOffsetX(0); }
|
||||
public void setAnchorOffsetX(float x) { setAnchorOffsetX(0, x); }
|
||||
public float getAnchorOffsetY() { return getAnchorOffsetY(0); }
|
||||
public void setAnchorOffsetY(float y) { setAnchorOffsetY(0, y); }
|
||||
public float getAnchorOffsetZ() { return getAnchorOffsetZ(0); }
|
||||
public void setAnchorOffsetZ(float z) { setAnchorOffsetZ(0, z); }
|
||||
|
||||
//@Override
|
||||
public int getAnchorPoint(int orb) { return getAnchorData(orb).anchorPoint.ordinal(); }
|
||||
public int getAnchorPoint() { return getAnchorData(0).anchorPoint.ordinal(); }
|
||||
|
||||
//@Override
|
||||
public void setAnchorPoint(int orb, int point) { getAnchorData(orb).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
public void setAnchorPoint(int point) { getAnchorData(0).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Entity createPreviewEntity(EntityNPCInterface npc) {
|
||||
if (npc == null || npc.worldObj == null) return null;
|
||||
|
||||
EntityAbilityOrb orb = new EntityAbilityOrb(npc.worldObj);
|
||||
orb.setupPreview(npc, orbSize, colorData, lightningData, anchorData[0], windUpTicks);
|
||||
return orb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPreviewActiveDuration() {
|
||||
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getOrbSpeed, this::setOrbSpeed)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("stats.size", this::getOrbSize, this::setOrbSize),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.barrage"),
|
||||
FieldDef.row(
|
||||
FieldDef.intField("ability.amount", this::getOrbAmount, this::setOrbAmount),
|
||||
FieldDef.intField("ability.firingSpeed", this::getFiringSpeed, this::setFiringSpeed)
|
||||
),
|
||||
FieldDef.boolField("ability.dualCharge", this::isDualCharging, this::setDualCharging),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming).hover("ability.hover.homing"),
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength).visibleWhen(this::isHoming),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive).hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius).visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
|
||||
|
||||
// Visual tab
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor).tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled).tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
|
||||
.range(0, 1).visibleWhen(this::isOuterColorEnabled)
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.effects").tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed).tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect).tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -457,8 +457,8 @@ public class AbilityOrbDual extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -555,7 +555,7 @@ public class AbilityOrbDual extends Ability {
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -251,8 +251,8 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
@@ -266,6 +266,6 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive).hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius).visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -166,8 +166,8 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.section("ability.section.push"),
|
||||
FieldDef.row(
|
||||
@@ -176,6 +176,6 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
),
|
||||
FieldDef.intField("ability.maxTargets", this::getMaxTargets, this::setMaxTargets),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -130,9 +130,46 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
launchTowardTarget(caster);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the initial vertical velocity needed to reach a target height
|
||||
* in Minecraft's physics (gravity=0.08, vertical drag=0.98).
|
||||
* Uses iterative simulation since the drag makes a closed-form solution impractical.
|
||||
*/
|
||||
private static double calculateLaunchVelocity(double targetHeight) {
|
||||
// Binary search for the initial velocity that reaches targetHeight
|
||||
double lo = 0.0, hi = 10.0;
|
||||
for (int iter = 0; iter < 30; iter++) {
|
||||
double mid = (lo + hi) / 2.0;
|
||||
double maxY = simulateMaxHeight(mid);
|
||||
if (maxY < targetHeight) {
|
||||
lo = mid;
|
||||
} else {
|
||||
hi = mid;
|
||||
}
|
||||
}
|
||||
return (lo + hi) / 2.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate Minecraft vertical physics to find peak height reached
|
||||
* with a given initial upward velocity.
|
||||
*/
|
||||
private static double simulateMaxHeight(double vy) {
|
||||
double y = 0;
|
||||
double maxY = 0;
|
||||
for (int t = 0; t < 200 && vy > 0; t++) {
|
||||
y += vy;
|
||||
vy -= 0.08; // gravity
|
||||
vy *= 0.98; // vertical drag
|
||||
if (y > maxY) maxY = y;
|
||||
}
|
||||
return maxY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate ballistic arc and launch caster toward target.
|
||||
* Accounts for Minecraft's drag physics to actually reach the destination.
|
||||
* leapHeight = exact peak height in blocks above launch point.
|
||||
* leapSpeed = velocity multiplier (faster motion, same height).
|
||||
*/
|
||||
private void launchTowardTarget(EntityLivingBase caster) {
|
||||
double dx = targetX - caster.posX;
|
||||
@@ -140,11 +177,15 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
double dz = targetZ - caster.posZ;
|
||||
double horizontalDist = Math.sqrt(dx * dx + dz * dz);
|
||||
|
||||
// Calculate vertical velocity to reach exact leapHeight
|
||||
double arcHeight = Math.max(1.0, leapHeight);
|
||||
double vy = calculateLaunchVelocity(arcHeight);
|
||||
|
||||
// For AOE_SELF or very close targets, just hop in place
|
||||
if (horizontalDist < 0.5) {
|
||||
caster.motionX = 0;
|
||||
caster.motionZ = 0;
|
||||
caster.motionY = 0.8 * leapSpeed;
|
||||
caster.motionY = vy;
|
||||
hasLaunched = true;
|
||||
if (caster instanceof EntityNPCInterface) {
|
||||
((EntityNPCInterface) caster).setNpcJumpingState(true);
|
||||
@@ -164,8 +205,9 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
targetZ = caster.posZ + dz;
|
||||
}
|
||||
|
||||
// Choose flight time based on distance - shorter distances = faster
|
||||
int flightTicks = (int) Math.max(15, Math.min(horizontalDist * 1.5, 30));
|
||||
// Choose flight time based on distance, scaled by speed (faster = fewer ticks)
|
||||
double speedFactor = Math.max(0.1, leapSpeed);
|
||||
int flightTicks = (int) Math.max(10, Math.min(horizontalDist * 1.5 / speedFactor, 40));
|
||||
|
||||
// Minecraft applies drag of 0.91 per tick to horizontal motion in air
|
||||
// Total distance traveled with initial velocity v0 over n ticks:
|
||||
@@ -175,34 +217,16 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
double dragPowN = Math.pow(drag, flightTicks);
|
||||
double vHorizontal = horizontalDist * (1.0 - drag) / (1.0 - dragPowN);
|
||||
|
||||
// Scale by leap speed
|
||||
vHorizontal *= leapSpeed;
|
||||
// Speed scales horizontal velocity to cover ground faster
|
||||
vHorizontal *= speedFactor;
|
||||
|
||||
// Vertical velocity calculation:
|
||||
// Minecraft gravity is 0.08 per tick, with 0.98 drag on vertical motion
|
||||
// For a nice arc, we want to peak roughly in the middle of the flight
|
||||
double gravity = 0.08;
|
||||
double verticalDrag = 0.98;
|
||||
|
||||
// Calculate required upward velocity to create a nice arc and land at target height
|
||||
// Peak height should be proportional to horizontal distance for visual appeal
|
||||
double arcHeight = Math.max(1.0, leapHeight) * leapSpeed;
|
||||
|
||||
// Approximate the required initial vertical velocity
|
||||
// Account for gravity and drag - use a simplified model
|
||||
double peakTicks = flightTicks * 0.4; // Peak around 40% through flight
|
||||
double vy = (arcHeight * 2.0 / peakTicks) + (gravity * peakTicks * 0.5);
|
||||
|
||||
// Adjust for height difference
|
||||
// Adjust vertical velocity for height difference between start and target
|
||||
if (dy > 0) {
|
||||
vy += dy / flightTicks * 1.5; // Going up - need more velocity
|
||||
} else if (dy < 0) {
|
||||
vy += dy / flightTicks * 0.3; // Going down - gravity helps
|
||||
}
|
||||
|
||||
// Ensure minimum upward velocity for visible jump
|
||||
vy = Math.max(vy, 0.6 * leapSpeed);
|
||||
|
||||
// Normalize horizontal direction and apply velocity
|
||||
double dirX = dx / horizontalDist;
|
||||
double dirZ = dz / horizontalDist;
|
||||
@@ -221,7 +245,6 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
float targetYaw = (float) (Math.atan2(-dx, dz) * 180.0D / Math.PI);
|
||||
caster.rotationYaw = targetYaw;
|
||||
caster.rotationYawHead = targetYaw;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -395,10 +418,14 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
double dz = tz - npc.posZ;
|
||||
double horizontalDist = Math.sqrt(dx * dx + dz * dz);
|
||||
|
||||
// Calculate vertical velocity for exact leapHeight
|
||||
double arcHeight = Math.max(1.0, leapHeight);
|
||||
double vy = calculateLaunchVelocity(arcHeight);
|
||||
|
||||
if (horizontalDist < 0.5) {
|
||||
previewVelX = 0;
|
||||
previewVelZ = 0;
|
||||
previewVelY = 0.8 * leapSpeed;
|
||||
previewVelY = vy;
|
||||
} else {
|
||||
if (horizontalDist > maxRange) {
|
||||
double scale = maxRange / horizontalDist;
|
||||
@@ -407,15 +434,11 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
horizontalDist = maxRange;
|
||||
}
|
||||
|
||||
int flightTicks = (int) Math.max(15, Math.min(horizontalDist * 1.5, 30));
|
||||
double speedFactor = Math.max(0.1, leapSpeed);
|
||||
int flightTicks = (int) Math.max(10, Math.min(horizontalDist * 1.5 / speedFactor, 40));
|
||||
double drag = 0.91;
|
||||
double dragPowN = Math.pow(drag, flightTicks);
|
||||
double vHorizontal = horizontalDist * (1.0 - drag) / (1.0 - dragPowN) * leapSpeed;
|
||||
|
||||
double arcHeight = Math.max(1.0, leapHeight) * leapSpeed;
|
||||
double peakTicks = flightTicks * 0.4;
|
||||
double vy = (arcHeight * 2.0 / peakTicks) + (0.08 * peakTicks * 0.5);
|
||||
vy = Math.max(vy, 0.6 * leapSpeed);
|
||||
double vHorizontal = horizontalDist * (1.0 - drag) / (1.0 - dragPowN) * speedFactor;
|
||||
|
||||
double dirX = dx / horizontalDist;
|
||||
double dirZ = dz / horizontalDist;
|
||||
@@ -574,8 +597,8 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getRadius, this::setRadius),
|
||||
@@ -587,6 +610,6 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
FieldDef.floatField("gui.height", this::getLeapHeight, this::setLeapHeight)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -199,8 +199,8 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -234,6 +234,6 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -558,8 +558,8 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.enumField("ability.mode", TeleportMode.class, this::getModeEnum, this::setModeEnum),
|
||||
FieldDef.floatField("ability.blinkRadius", this::getBlinkRadius, this::setBlinkRadius)
|
||||
.visibleWhen(() -> this.getModeEnum() == TeleportMode.BLINK || this.getModeEnum() == TeleportMode.SINGLE),
|
||||
@@ -586,6 +586,6 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
.hover("ability.hover.dmgAtEnd")
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -468,8 +468,8 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||
.range(1, 2000),
|
||||
FieldDef.enumField("ability.placement", TrapPlacement.class, this::getPlacementEnum, this::setPlacementEnum)
|
||||
@@ -490,6 +490,6 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
double dz = destZ - entity.posZ;
|
||||
double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
|
||||
if (dist <= 1.0f) {
|
||||
if (dist <= 1.5f) {
|
||||
getPulledEntities().remove(uuid);
|
||||
onTargetArrived(caster, entity, world);
|
||||
continue;
|
||||
@@ -146,7 +146,10 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
|
||||
anyStillPulling = true;
|
||||
|
||||
double factor = pullStrength / dist;
|
||||
// Clamp speed to never exceed half the remaining distance, preventing overshoot/slingshot
|
||||
double maxSpeed = dist * 0.5;
|
||||
double effectiveSpeed = Math.min(pullStrength, maxSpeed);
|
||||
double factor = effectiveSpeed / dist;
|
||||
double nextX = dx * factor;
|
||||
double nextY = dy * factor * 0.5;
|
||||
double nextZ = dz * factor;
|
||||
@@ -301,8 +304,8 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.pullRadius", this::getPullRadius, this::setPullRadius),
|
||||
FieldDef.floatField("ability.pullStrength", this::getPullStrength, this::setPullStrength)
|
||||
@@ -323,6 +326,6 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
FieldDef.floatField("enchantment.damage", this::getPullDamage, this::setPullDamage)
|
||||
.visibleWhen(this::isDamageOnPull),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -192,6 +192,19 @@ public abstract class EntityAbilityProjectile extends Entity implements IEntityA
|
||||
|
||||
// Skip lifetime/distance checks in preview mode
|
||||
if (!previewMode) {
|
||||
// Failsafe: if owner entity is gone, dead, or NPC was killed/reset, self-destruct
|
||||
if (ownerEntityId >= 0 && ticksExisted > 5) {
|
||||
Entity owner = worldObj.getEntityByID(ownerEntityId);
|
||||
if (owner == null || owner.isDead) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
if (owner instanceof EntityNPCInterface && ((EntityNPCInterface) owner).isKilled()) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Set death time on first tick if not already set (handles chunk load/unload)
|
||||
if (deathWorldTime < 0 && worldObj != null) {
|
||||
deathWorldTime = worldObj.getTotalWorldTime() + maxLifetime;
|
||||
@@ -392,6 +405,10 @@ public abstract class EntityAbilityProjectile extends Entity implements IEntityA
|
||||
|
||||
// ==================== ENTITY HELPERS ====================
|
||||
|
||||
public int getOwnerEntityId() {
|
||||
return ownerEntityId;
|
||||
}
|
||||
|
||||
protected Entity getOwner() {
|
||||
// In preview mode, use direct reference (no world lookup)
|
||||
if (previewMode && previewOwner != null) {
|
||||
|
||||
@@ -429,6 +429,14 @@ public class DataAbilities {
|
||||
playAbilityAnimation((Animation) AnimationController.Instance.get(animation));
|
||||
}
|
||||
|
||||
public void playAbilityAnimation(String animation) {
|
||||
if (animation.isEmpty()) return;
|
||||
if (AnimationController.Instance == null) return;
|
||||
if (AnimationController.Instance.get(animation, true) == null) return;
|
||||
|
||||
playAbilityAnimation((Animation) AnimationController.Instance.get(animation, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop any currently playing ability animation.
|
||||
*/
|
||||
@@ -501,18 +509,12 @@ public class DataAbilities {
|
||||
// Track hit for hit count condition
|
||||
recordHit();
|
||||
|
||||
// Check if currently executing a Guard ability and notify it of damage taken
|
||||
if (currentAbility instanceof AbilityGuard) {
|
||||
AbilityGuard guard = (AbilityGuard) currentAbility;
|
||||
if (guard.isGuarding() && source.getEntity() instanceof EntityLivingBase) {
|
||||
guard.onDamageTaken(npc, (EntityLivingBase) source.getEntity(), source, amount);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentAbility == null || !currentAbility.isExecuting()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
currentAbility.onDamageTaken(npc, (EntityLivingBase) source.getEntity(), source, amount);
|
||||
|
||||
if (currentAbility.canInterrupt(source)) {
|
||||
interruptCurrentAbility(source, amount);
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import kamkeel.npcs.addon.DBCAddon;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -80,13 +81,14 @@ public class CombatHandler {
|
||||
}
|
||||
|
||||
// Handle guard counter before interruption
|
||||
if (npc.abilities.getCurrentAbility() instanceof kamkeel.npcs.controllers.data.ability.type.AbilityGuard) {
|
||||
kamkeel.npcs.controllers.data.ability.type.AbilityGuard guard =
|
||||
(kamkeel.npcs.controllers.data.ability.type.AbilityGuard) npc.abilities.getCurrentAbility();
|
||||
if (guard.isGuarding() && e instanceof EntityLivingBase) {
|
||||
guard.onDamageTaken(npc, (EntityLivingBase) e, source, damageAmount);
|
||||
}
|
||||
}
|
||||
|
||||
// if (npc.abilities.getCurrentAbility() instanceof AbilityGuard) {
|
||||
// AbilityGuard guard =
|
||||
// (AbilityGuard) npc.abilities.getCurrentAbility();
|
||||
// if (guard.isGuarding() && e instanceof EntityLivingBase) {
|
||||
// guard.onDamageTaken(npc, (EntityLivingBase) e, source, damageAmount);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Check for ability interruption
|
||||
npc.abilities.onDamage(source, damageAmount);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
this.callback = callback;
|
||||
this.conditions = new ArrayList<>(ability.getConditions());
|
||||
|
||||
this.fieldDefs = ability.getAllFieldDefinitions();
|
||||
this.fieldDefs = ability.getAllDefinitions();
|
||||
discoverCustomTabs();
|
||||
|
||||
setBackground("menubg.png", 217);
|
||||
@@ -281,11 +281,9 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
|
||||
// Declarative field handling (effects list, booleans, enums, sub-guis, clear buttons)
|
||||
if (builder.handleButtonEvent(id, guibutton)) {
|
||||
// SUB_GUI needs special handling: open the sub-gui
|
||||
FieldDef subGuiDef = builder.getActiveSubGuiField();
|
||||
if (subGuiDef != null && subGuiDef.getSubGuiFactory() != null) {
|
||||
setSubGui(subGuiDef.getSubGuiFactory().get());
|
||||
} else {
|
||||
// SUB_GUI fields are opened directly by the builder via setSubGuiWithResult().
|
||||
// Only rebuild if no sub-gui was opened (e.g. boolean toggle, enum change).
|
||||
if (!hasSubGui()) {
|
||||
initGui();
|
||||
}
|
||||
return;
|
||||
@@ -378,7 +376,7 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
ability.readNBT(nbt);
|
||||
|
||||
this.conditions = new ArrayList<>(ability.getConditions());
|
||||
this.fieldDefs = ability.getAllFieldDefinitions();
|
||||
this.fieldDefs = ability.getAllDefinitions();
|
||||
discoverCustomTabs();
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import noppes.npcs.client.gui.select.GuiAnimationSelection;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
@@ -297,4 +298,74 @@ public class FieldDef {
|
||||
public FieldDef getLeftChild() { return leftChild; }
|
||||
public FieldDef getRightChild() { return rightChild; }
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// LIST MANIPULATION (for mod injection)
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/**
|
||||
* Insert a field before the first field matching the target label.
|
||||
* Searches top-level labels and ROW children.
|
||||
*
|
||||
* @param fields The field list to modify
|
||||
* @param targetLabel The label of the field to insert before
|
||||
* @param newField The field to insert
|
||||
* @return true if the target was found and the field was inserted
|
||||
*/
|
||||
public static boolean insertBefore(java.util.List<FieldDef> fields, String targetLabel, FieldDef newField) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
if (matchesLabel(fields.get(i), targetLabel)) {
|
||||
fields.add(i, newField);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a field after the first field matching the target label.
|
||||
* Searches top-level labels and ROW children.
|
||||
*
|
||||
* @param fields The field list to modify
|
||||
* @param targetLabel The label of the field to insert after
|
||||
* @param newField The field to insert
|
||||
* @return true if the target was found and the field was inserted
|
||||
*/
|
||||
public static boolean insertAfter(List<FieldDef> fields, String targetLabel, FieldDef newField) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
if (matchesLabel(fields.get(i), targetLabel)) {
|
||||
fields.add(i + 1, newField);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the visibility condition of a field.
|
||||
* Searches top-level labels and ROW children.
|
||||
*
|
||||
* @param fields The field list to modify
|
||||
* @param targetLabel The label of the field to modify
|
||||
* @param condition The condition to replace
|
||||
* @return true if the target was found and the condition was modified
|
||||
*/
|
||||
public static boolean modifyVisibility(List<FieldDef> fields, String targetLabel, BooleanSupplier condition) {
|
||||
for (FieldDef field : fields) {
|
||||
if (matchesLabel(field, targetLabel)) {
|
||||
field.visibleWhen(condition);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean matchesLabel(FieldDef def, String targetLabel) {
|
||||
if (targetLabel.equals(def.label)) return true;
|
||||
if (def.type == FieldType.ROW) {
|
||||
if (def.leftChild != null && targetLabel.equals(def.leftChild.label)) return true;
|
||||
if (def.rightChild != null && targetLabel.equals(def.rightChild.label)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -333,11 +333,13 @@ public class GuiFieldBuilder {
|
||||
// EVENT HANDLING
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
private FieldDef activeSubGuiField;
|
||||
|
||||
/**
|
||||
* Handles button events for declarative fields.
|
||||
* Call from parent GUI's buttonEvent(). Returns true if the event was handled.
|
||||
* <p>
|
||||
* For SUB_GUI fields, the sub-gui is opened directly via {@code parent.setSubGuiWithResult()},
|
||||
* so the result handler survives initGui() rebuilds. After this returns true, check
|
||||
* {@code parent.hasSubGui()} to determine if initGui() should be called.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public boolean handleButtonEvent(int buttonId, GuiButton button) {
|
||||
@@ -374,7 +376,13 @@ public class GuiFieldBuilder {
|
||||
return true;
|
||||
}
|
||||
case SUB_GUI:
|
||||
activeSubGuiField = def;
|
||||
if (def.getSubGuiFactory() != null) {
|
||||
parent.setSubGuiWithResult(def.getSubGuiFactory().get(), sub -> {
|
||||
if (def.getSubGuiResultHandler() != null) {
|
||||
def.getSubGuiResultHandler().accept(sub);
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -406,32 +414,16 @@ public class GuiFieldBuilder {
|
||||
|
||||
/**
|
||||
* Handles sub-gui close events. Call from parent GUI's subGuiClosed().
|
||||
* Returns true if the event was handled (activeSubGuiField was set).
|
||||
* <p>
|
||||
* Note: SUB_GUI fields opened via handleButtonEvent use
|
||||
* {@code parent.setSubGuiWithResult()}, so their results are handled
|
||||
* automatically by {@code GuiNPCInterface.closeSubGui()}. This method
|
||||
* only handles sub-guis opened through other means.
|
||||
*/
|
||||
public boolean handleSubGuiClosed(SubGuiInterface subgui) {
|
||||
if (activeSubGuiField != null) {
|
||||
FieldDef def = activeSubGuiField;
|
||||
activeSubGuiField = null;
|
||||
if (def.getSubGuiResultHandler() != null) {
|
||||
def.getSubGuiResultHandler().accept(subgui);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the FieldDef for the currently active sub-gui, or null.
|
||||
* After handleButtonEvent returns true for a SUB_GUI field, the parent
|
||||
* should check this and call setSubGui(def.getSubGuiFactory().get()).
|
||||
*/
|
||||
public FieldDef getActiveSubGuiField() { return activeSubGuiField; }
|
||||
|
||||
/**
|
||||
* Clears the active sub-gui field tracking.
|
||||
*/
|
||||
public void clearActiveSubGuiField() { activeSubGuiField = null; }
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// GETTERS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class GuiNPCInterface extends GuiScreen {
|
||||
@@ -52,6 +53,7 @@ public abstract class GuiNPCInterface extends GuiScreen {
|
||||
public Supplier<Boolean> closeOnEscSupplier = null;
|
||||
public int guiLeft, guiTop, xSize, ySize;
|
||||
private SubGuiInterface subgui;
|
||||
private Consumer<SubGuiInterface> pendingSubGuiResult;
|
||||
public int mouseX, mouseY, mouseScroll;
|
||||
public float bgScale = 1;
|
||||
public float bgScaleX = 1;
|
||||
@@ -519,7 +521,21 @@ public abstract class GuiNPCInterface extends GuiScreen {
|
||||
initGui();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a sub-gui with a result handler that will be called when the sub-gui closes.
|
||||
* The handler survives initGui() rebuilds since it lives on the parent, not the builder.
|
||||
*/
|
||||
public void setSubGuiWithResult(SubGuiInterface gui, Consumer<SubGuiInterface> resultHandler) {
|
||||
this.pendingSubGuiResult = resultHandler;
|
||||
setSubGui(gui);
|
||||
}
|
||||
|
||||
public void closeSubGui(SubGuiInterface gui) {
|
||||
if (pendingSubGuiResult != null) {
|
||||
Consumer<SubGuiInterface> handler = pendingSubGuiResult;
|
||||
pendingSubGuiResult = null;
|
||||
handler.accept(gui);
|
||||
}
|
||||
subgui = null;
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -453,13 +453,29 @@ public class PlayerAbilityData implements IPlayerAbilityData {
|
||||
// ANIMATION
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
private void playAbilityAnimation(Animation animation) {
|
||||
public void playAbilityAnimation(Animation animation) {
|
||||
if (animation == null || AnimationController.Instance == null) return;
|
||||
playerData.animationData.setEnabled(true);
|
||||
playerData.animationData.setAnimation(animation);
|
||||
playerData.animationData.updateClient();
|
||||
}
|
||||
|
||||
public void playAbilityAnimation(int animation) {
|
||||
if (animation < 0) return;
|
||||
if (AnimationController.Instance == null) return;
|
||||
if (AnimationController.Instance.get(animation) == null) return;
|
||||
|
||||
playAbilityAnimation((Animation) AnimationController.Instance.get(animation));
|
||||
}
|
||||
|
||||
public void playAbilityAnimation(String animation) {
|
||||
if (animation.isEmpty()) return;
|
||||
if (AnimationController.Instance == null) return;
|
||||
if (AnimationController.Instance.get(animation, true) == null) return;
|
||||
|
||||
playAbilityAnimation((Animation) AnimationController.Instance.get(animation, true));
|
||||
}
|
||||
|
||||
private void stopAbilityAnimation() {
|
||||
playerData.animationData.setAnimation(null);
|
||||
playerData.animationData.updateClient();
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"Loop": 0,
|
||||
"Speed": 1.0f,
|
||||
"Frames": [
|
||||
{
|
||||
"ColorMarker": 16777215,
|
||||
"Comment": "",
|
||||
"Speed": 2.0f,
|
||||
"FrameParts": [
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "RIGHT_ARM",
|
||||
"Rotation1": -80.0f,
|
||||
"Rotation0": -120.0f,
|
||||
"Pivot0": 2.0f,
|
||||
"Pivot1": 2.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "LEFT_ARM",
|
||||
"Rotation1": 80.0f,
|
||||
"Rotation0": -120.0f,
|
||||
"Pivot0": -2.0f,
|
||||
"Pivot1": 2.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "HEAD",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 12.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
}
|
||||
],
|
||||
"Smooth": 0b,
|
||||
"Duration": 10
|
||||
}
|
||||
],
|
||||
"CurrentFrameTime": 0,
|
||||
"CurrentFrame": 0,
|
||||
"Smooth": 0b,
|
||||
"ID": 18,
|
||||
"WhileAttacking": 1b,
|
||||
"WhileWalking": 1b,
|
||||
"Name": "Ability_Guard_Active",
|
||||
"WhileStanding": 1b
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
{
|
||||
"Loop": 2,
|
||||
"Speed": 1.0f,
|
||||
"Frames": [
|
||||
{
|
||||
"ColorMarker": 16777215,
|
||||
"Comment": "",
|
||||
"Speed": 2.0f,
|
||||
"FrameParts": [
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "LEFT_LEG",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 0.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "RIGHT_ARM",
|
||||
"Rotation1": -80.0f,
|
||||
"Rotation0": -120.0f,
|
||||
"Pivot0": 2.0f,
|
||||
"Pivot1": 2.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "LEFT_ARM",
|
||||
"Rotation1": 80.0f,
|
||||
"Rotation0": -120.0f,
|
||||
"Pivot0": -2.0f,
|
||||
"Pivot1": 2.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "HEAD",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 12.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "BODY",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 0.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "RIGHT_LEG",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 0.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
}
|
||||
],
|
||||
"Smooth": 0b,
|
||||
"Duration": 3
|
||||
},
|
||||
{
|
||||
"ColorMarker": 16777215,
|
||||
"Comment": "",
|
||||
"Speed": 2.0f,
|
||||
"FrameParts": [
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "LEFT_LEG",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 6.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "RIGHT_ARM",
|
||||
"Rotation1": -20.0f,
|
||||
"Rotation0": 90.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": 60.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "LEFT_ARM",
|
||||
"Rotation1": 20.0f,
|
||||
"Rotation0": 90.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": -60.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -6.0f,
|
||||
"Part": "HEAD",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 25.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -6.0f,
|
||||
"Part": "BODY",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 31.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "RIGHT_LEG",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 31.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 1.0f,
|
||||
"Rotation2": 0.0f
|
||||
}
|
||||
],
|
||||
"Smooth": 0b,
|
||||
"Duration": 3
|
||||
},
|
||||
{
|
||||
"ColorMarker": 16777215,
|
||||
"Comment": "",
|
||||
"Speed": 0.8f,
|
||||
"FrameParts": [
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "LEFT_LEG",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 6.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 0.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "RIGHT_ARM",
|
||||
"Rotation1": -20.0f,
|
||||
"Rotation0": 90.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": 60.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -3.0f,
|
||||
"Part": "LEFT_ARM",
|
||||
"Rotation1": 20.0f,
|
||||
"Rotation0": 90.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": -60.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -6.0f,
|
||||
"Part": "HEAD",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 25.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": -6.0f,
|
||||
"Part": "BODY",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 31.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 3.0f,
|
||||
"Rotation2": 0.0f
|
||||
},
|
||||
{
|
||||
"Pivot2": 0.0f,
|
||||
"Part": "RIGHT_LEG",
|
||||
"Rotation1": 0.0f,
|
||||
"Rotation0": 31.0f,
|
||||
"Pivot0": 0.0f,
|
||||
"Pivot1": 1.0f,
|
||||
"Rotation2": 0.0f
|
||||
}
|
||||
],
|
||||
"Smooth": 0b,
|
||||
"Duration": 10
|
||||
}
|
||||
],
|
||||
"CurrentFrameTime": 0,
|
||||
"CurrentFrame": 0,
|
||||
"Smooth": 0b,
|
||||
"ID": 17,
|
||||
"WhileAttacking": 1b,
|
||||
"WhileWalking": 1b,
|
||||
"Name": "Ability_Guard_Counter",
|
||||
"WhileStanding": 1b
|
||||
}
|
||||
@@ -1608,6 +1608,7 @@ ability.cnpc.beam_dual=Beam Dual
|
||||
ability.cnpc.projectile=Projectile
|
||||
ability.cnpc.orb=Orb
|
||||
ability.cnpc.orb_dual=Orb Dual
|
||||
ability.cnpc.orb_barrage=Orb Barrage
|
||||
ability.cnpc.charge=Charge
|
||||
ability.cnpc.dash=Dash
|
||||
ability.cnpc.teleport=Teleport
|
||||
@@ -1643,8 +1644,10 @@ ability.conditions=Conditions
|
||||
# Effects Tab
|
||||
ability.windUpSound=Wind Up Sound
|
||||
ability.activeSound=Active Sound
|
||||
ability.counterSound=Counter Sound
|
||||
ability.windUpAnimation=Wind Up Animation
|
||||
ability.activeAnimation=Active Animation
|
||||
ability.counterAnimation=Counter Animation
|
||||
ability.showTelegraph=Show Telegraph
|
||||
ability.windUpColor=Wind Up Color
|
||||
ability.activeColor=Active Color
|
||||
@@ -1672,6 +1675,7 @@ ability.section.disc1=Disc 1
|
||||
ability.section.disc2=Disc 2
|
||||
ability.section.orb1=Orb 1
|
||||
ability.section.orb2=Orb 2
|
||||
ability.section.barrage=Barrage
|
||||
ability.section.counter=Counter
|
||||
ability.section.area=Area
|
||||
ability.section.damage=Damage
|
||||
@@ -1763,6 +1767,7 @@ ability.pushStrength=Push Strength
|
||||
|
||||
# Guard
|
||||
ability.damageReduction=Damage Reduction
|
||||
ability.counterWindow=Counter Ticks
|
||||
|
||||
# Heal
|
||||
ability.instantHeal=Instant Heal
|
||||
|
||||
Reference in new issue
Block a user