mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 06:52:21 +00:00
Ability Changes
This commit is contained in:
1 parent
92e69bb270
commit
de043f4a25
51 files changed
+6287
-915
No files matched your search
@@ -3,6 +3,7 @@ package noppes.npcs;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityPhase;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.network.packets.data.telegraph.TelegraphRemovePacket;
|
||||
import kamkeel.npcs.network.packets.data.telegraph.TelegraphSpawnPacket;
|
||||
@@ -444,7 +445,7 @@ public class DataAbilities {
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/**
|
||||
* Handle damage taken - may interrupt current ability.
|
||||
* Handle damage taken - may interrupt current ability or trigger guard counter.
|
||||
*
|
||||
* @param source The damage source
|
||||
* @param amount The damage amount
|
||||
@@ -454,6 +455,14 @@ 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;
|
||||
}
|
||||
@@ -466,6 +475,18 @@ public class DataAbilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the damage reduction factor if a Guard ability is currently active.
|
||||
*
|
||||
* @return The damage reduction factor (0.0 = no reduction, 1.0 = full immunity), or 0 if not guarding
|
||||
*/
|
||||
public float getGuardDamageReduction() {
|
||||
if (currentAbility instanceof AbilityGuard) {
|
||||
return ((AbilityGuard) currentAbility).getDamageReductionFactor();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a hit for the hit count condition.
|
||||
*/
|
||||
@@ -553,7 +574,7 @@ public class DataAbilities {
|
||||
* @param hitEntity The entity being hit
|
||||
* @param damage The damage amount
|
||||
* @param knockback The horizontal knockback
|
||||
* @param knockbackUp The vertical knockback (deprecated, ignored)
|
||||
* @param knockbackUp The vertical knockback
|
||||
* @return The event (with possibly modified values), or null if cancelled
|
||||
*/
|
||||
public AbilityEvent.HitEvent fireHitEvent(Ability ability, EntityLivingBase target,
|
||||
@@ -686,16 +707,6 @@ public class DataAbilities {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if NPC movement should be blocked due to ability execution.
|
||||
*
|
||||
* @deprecated Use isAbilityControllingMovement() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isMovementBlocked() {
|
||||
return isAbilityControllingMovement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if NPC should skip normal attacks during ability execution.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user