mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 14:59:05 +00:00
Fix Burst Refire
This commit is contained in:
1 parent
e466ef6771
commit
8c2ef1084a
4 files changed
+32
-10
No files matched your search
@@ -910,9 +910,9 @@ public abstract class Ability implements IAbility {
|
||||
if (phase == AbilityPhase.ACTIVE) {
|
||||
// Check if more burst iterations remain
|
||||
if (burstEnabled && burstAmount > 0 && burstIndex < burstAmount) {
|
||||
if (!burstOverlap) {
|
||||
cleanup();
|
||||
}
|
||||
// Don't cleanup here - entities may still be in flight
|
||||
// For non-overlap: cleaned up when next burst starts (in onExecute)
|
||||
// For overlap: entities continue flying indefinitely
|
||||
burstIndex++;
|
||||
phase = AbilityPhase.BURST_DELAY;
|
||||
currentTick = 0;
|
||||
|
||||
+27
-5
@@ -258,9 +258,13 @@ public abstract class AbstractEnergyProjectileAbility<E extends EntityAbilityPro
|
||||
public void onExecute(EntityLivingBase caster, EntityLivingBase target) {
|
||||
// Create fresh entities if needed:
|
||||
// - entities == null: windup was skipped (burst without replay animations)
|
||||
// - isBurstRefire(): burst overlap mode kept old (stale) entities alive,
|
||||
// - isBurstRefire(): previous burst entities may still be alive,
|
||||
// so we must create new ones for each burst iteration
|
||||
if (entities == null || isBurstRefire()) {
|
||||
// Non-overlap burst refire: kill old entities before creating new ones
|
||||
if (isBurstRefire() && !burstOverlap && entities != null) {
|
||||
cleanup();
|
||||
}
|
||||
entities = createAllEntities(caster, target);
|
||||
for (E entity : entities) {
|
||||
spawnAbilityEntity(entity);
|
||||
@@ -294,14 +298,32 @@ public abstract class AbstractEnergyProjectileAbility<E extends EntityAbilityPro
|
||||
}
|
||||
}
|
||||
|
||||
// Check if all entities are dead
|
||||
// Check if all entities are dead or unreachable
|
||||
boolean allDead = true;
|
||||
for (E entity : entities) {
|
||||
if (entity != null && !entity.isDead) {
|
||||
allDead = false;
|
||||
break;
|
||||
if (entity == null || entity.isDead) continue;
|
||||
|
||||
// Check if entity was removed from world (chunk unload, etc.)
|
||||
if (tick > 5 && entity.worldObj != null
|
||||
&& entity.worldObj.getEntityByID(entity.getEntityId()) != entity) {
|
||||
entity.setDead();
|
||||
continue;
|
||||
}
|
||||
|
||||
allDead = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Failsafe timeout: force completion if active phase exceeded max possible flight time
|
||||
if (!allDead) {
|
||||
int lastFireTick = fireDelay > 0 ? fireDelay * (projectileCount - 1) : 0;
|
||||
int maxFlightTime = lifespanData.maxLifetime > 0 ? lifespanData.maxLifetime : 200;
|
||||
if (tick > lastFireTick + maxFlightTime + 20) {
|
||||
cleanup();
|
||||
allDead = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (allDead) {
|
||||
signalCompletion();
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class DataAbilities {
|
||||
// This allows entity-spawning abilities to immediately chain next burst
|
||||
// without each type needing to check burst state in their onActiveTick()
|
||||
// Wait until all staggered projectiles have been fired before auto-completing
|
||||
if (currentAbility.isBurstEnabled() && currentAbility.isBurstOverlap()
|
||||
if (currentAbility.isBurstEnabled()
|
||||
&& currentAbility.getBurstIndex() < currentAbility.getBurstAmount()
|
||||
&& currentAbility.getPhase() == AbilityPhase.ACTIVE
|
||||
&& currentAbility.isReadyForBurstCompletion(currentAbility.getCurrentTick())) {
|
||||
|
||||
@@ -220,7 +220,7 @@ public class PlayerAbilityData implements IPlayerAbilityData {
|
||||
}
|
||||
|
||||
// Auto-complete for burst overlap mode (entities fly independently)
|
||||
if (currentAbility.isBurstEnabled() && currentAbility.isBurstOverlap()
|
||||
if (currentAbility.isBurstEnabled()
|
||||
&& currentAbility.getBurstIndex() < currentAbility.getBurstAmount()
|
||||
&& currentAbility.getPhase() == AbilityPhase.ACTIVE
|
||||
&& currentAbility.isReadyForBurstCompletion(currentAbility.getCurrentTick())) {
|
||||
|
||||
Reference in new issue
Block a user