Counter, Dodge, Guard Abilities [WIP]

This commit is contained in:
Kam committed 2026-02-28 23:23:52 -05:00
1 parent d3d9dd352a
commit fc71fb5a33
12 files changed
+624 -421

No files matched your search

+2 -32
View File
@@ -7,10 +7,11 @@ import kamkeel.npcs.controllers.data.ability.enums.AbilityPhase;
import kamkeel.npcs.controllers.data.ability.data.ChainedAbility;
import kamkeel.npcs.controllers.data.ability.data.IAbilityAction;
import kamkeel.npcs.controllers.data.ability.data.entry.AbilityToggleEntry;
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
import kamkeel.npcs.controllers.data.ability.type.AbilityDefend;
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
import kamkeel.npcs.network.packets.data.telegraph.TelegraphRemovePacket;
import kamkeel.npcs.network.packets.data.telegraph.TelegraphSpawnPacket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -516,11 +517,6 @@ public class DataAbilities extends AbstractDataAbilities {
// Track hit for hit count condition
recordHit();
net.minecraft.entity.Entity sourceEntity = source.getEntity();
EntityLivingBase attacker = sourceEntity instanceof EntityLivingBase ? (EntityLivingBase) sourceEntity : null;
currentAbility.onDamageTaken(npc, attacker, source, amount);
if (currentAbility.canInterrupt(source)) {
interruptCurrentAbility(source, amount);
return true;
@@ -529,18 +525,6 @@ public class DataAbilities extends AbstractDataAbilities {
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.
* Includes periodic cleanup to prevent memory leak.
@@ -650,20 +634,6 @@ public class DataAbilities extends AbstractDataAbilities {
// SCRIPT EVENTS
// ═══════════════════════════════════════════════════════════════════
/**
* Fire an ability hit event. Called by abilities when they hit an entity.
* Returns null if the event was cancelled, otherwise returns the (possibly modified) event.
*
* @param ability The ability doing the hit
* @param target The original target of the ability
* @param hitEntity The entity being hit
* @param event The mutable hit event to fire
* @return true if the event was cancelled
*/
public boolean fireHitEvent(Ability ability, AbilityEvent.HitEvent event) {
return EventHooks.onAbilityHit(ability, event);
}
/**
* Get the NPC this DataAbilities belongs to.
*/