Package noppes.npcs.api.ability
Interface IAbility
-
- All Superinterfaces:
IAbilityAction
- All Known Subinterfaces:
IAbilityCharge,IAbilityCounter,IAbilityCutter,IAbilityDash,IAbilityDefend,IAbilityDisc,IAbilityDodge,IAbilityEffect,IAbilityEnergyBeam,IAbilityEnergyProjectile,IAbilityGuard,IAbilityHazard,IAbilityHeavyHit,IAbilityLaser,IAbilityOrb,IAbilityProjectile,IAbilityShockwave,IAbilitySlam,IAbilitySweeper,IAbilityTeleport,IAbilityTrap,IAbilityVortex,IAbilityZone,ICustomAbility
public interface IAbility extends IAbilityAction
Interface for NPC abilities. Abilities are special attacks or actions that NPCs can perform during combat.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetAllowedByType()Get the allowed user type for this ability.intgetBurstAmount()intgetBurstDelay()intgetCooldownTicks()Get the cooldown time in ticks.intgetCurrentTick()Get the current tick within the current phase.intgetDazedTicks()Get the dazed time in ticks (stun after interrupt during WINDUP).StringgetDisplayName()Get the display name (cosmetic).StringgetId()Get the unique ID (UUID for custom abilities, registry key for built-in).intgetLockMovementType()Get the lock movement type for this ability.IMagicDatagetMagicData()Get this ability's magic data.floatgetMaxRange()Get the maximum range at which this ability can be used.floatgetMinRange()Get the minimum range at which this ability can be used.StringgetName()Get the unique identifier/name of this ability (used for file naming, commands, search).INbtgetNbt()Get this ability's data as NBT.intgetPhaseInt()Get the current execution phase (0=IDLE, 1=WINDUP, 2=ACTIVE, 3=DAZED, 4=BURST_DELAY).intgetRotationModeType()Get the rotation mode for this ability.intgetRotationPhaseType()Get the rotation phase for this ability (when rotation mode applies).StringgetToggleStateLabel(int state)Get the display label for a specific toggle state (1-indexed).intgetToggleStates()Get the number of toggle states.floatgetTrackSpeedValue()Get track speed for TRACK rotation mode (blocks/second).StringgetTypeId()Get the type ID of this ability (e.g., "cnpc:slam", "cnpc:beam").intgetWeight()Get the selection weight for random ability selection.intgetWindUpTicks()Get the wind-up time in ticks (telegraph phase).booleanisBurstEnabled()booleanisBurstOverlap()booleanisBurstReplayAnimations()booleanisEnabled()Check if this ability is enabled.booleanisExecuting()Check if this ability is currently being executed.booleanisIgnoreCooldown()Check if this ability ignores cooldowns.booleanisIgnoreIFrames()Check if this ability ignores target invulnerability frames (hurt resistance).booleanisInterruptible()Check if this ability can be interrupted by damage.booleanisMovementLockedDuringActive()Check if movement (pathfinding/motion) is locked during the ACTIVE phase.booleanisMovementLockedDuringWindup()Check if movement (pathfinding/motion) is locked during the WINDUP phase.booleanisPerAbilityCooldown()Check if this ability uses per-ability cooldown instead of global cooldown.booleanisRotationLockedDuringActive()Check if rotation (yaw/pitch) is locked during the ACTIVE phase.booleanisRotationLockedDuringWindup()Check if rotation (yaw/pitch) is locked during the WINDUP phase.booleanisToggleable()Check if this ability is toggleable (has at least 1 toggle state).voidsetAllowedByType(int type)Set the allowed user type for this ability.voidsetBurstAmount(int amount)voidsetBurstDelay(int delay)voidsetBurstEnabled(boolean enabled)voidsetBurstOverlap(boolean overlap)voidsetBurstReplayAnimations(boolean replay)voidsetCooldownTicks(int ticks)Set the cooldown time in ticks.voidsetDazedTicks(int ticks)Set the dazed time in ticks.voidsetDisplayName(String displayName)Set the display name (cosmetic).voidsetEnabled(boolean enabled)Enable or disable this ability.voidsetId(String id)Set the unique ID of this ability instance.voidsetIgnoreCooldown(boolean ignore)Set whether this ability ignores cooldowns.voidsetIgnoreIFrames(boolean ignore)Set whether this ability ignores target invulnerability frames (hurt resistance).voidsetInterruptible(boolean interruptible)Set whether this ability can be interrupted.voidsetLockMovementType(int type)Set the lock movement type for this ability.voidsetMaxRange(float range)Set the maximum range.voidsetMinRange(float range)Set the minimum range.voidsetName(String name)Set the unique identifier/name of this ability.voidsetNbt(INbt nbt)Set this ability's data from NBT.voidsetPerAbilityCooldown(boolean perAbility)Set whether this ability uses per-ability cooldown.voidsetRotationModeType(int type)Set the rotation mode for this ability.voidsetRotationPhaseType(int type)Set the rotation phase for this ability.voidsetToggleStates(int states)Set the number of toggle states.voidsetTrackSpeedValue(float speed)Set track speed for TRACK rotation mode (blocks/second).voidsetWeight(int weight)Set the selection weight.voidsetWindUpTicks(int ticks)Set the wind-up time in ticks.-
Methods inherited from interface noppes.npcs.api.ability.IAbilityAction
isChain
-
-
-
-
Method Detail
-
getId
String getId()
Get the unique ID (UUID for custom abilities, registry key for built-in). This is the stable reference that never changes after creation.- Returns:
- the unique ability ID
-
setId
void setId(String id)
Set the unique ID of this ability instance.- Parameters:
id- Unique ability ID.
-
getName
String getName()
Get the unique identifier/name of this ability (used for file naming, commands, search).- Specified by:
getNamein interfaceIAbilityAction- Returns:
- The unique identifier/name of this action.
-
setName
void setName(String name)
Set the unique identifier/name of this ability.- Parameters:
name- Unique identifier.
-
getDisplayName
String getDisplayName()
Get the display name (cosmetic). Falls back to getName() if not set.- Returns:
- the display name
-
setDisplayName
void setDisplayName(String displayName)
Set the display name (cosmetic). Pass empty string to use getName() as display.- Parameters:
displayName- Display name, or empty string for default.
-
getTypeId
String getTypeId()
Get the type ID of this ability (e.g., "cnpc:slam", "cnpc:beam").- Returns:
- the type ID
-
isEnabled
boolean isEnabled()
Check if this ability is enabled.- Specified by:
isEnabledin interfaceIAbilityAction- Returns:
- Whether this action is enabled.
-
setEnabled
void setEnabled(boolean enabled)
Enable or disable this ability.- Parameters:
enabled- Whether the ability is enabled.
-
getWeight
int getWeight()
Get the selection weight for random ability selection. Higher weight = more likely to be selected.- Specified by:
getWeightin interfaceIAbilityAction- Returns:
- Selection weight for random ability selection (higher = more likely).
-
setWeight
void setWeight(int weight)
Set the selection weight.- Parameters:
weight- Selection weight (higher = more likely).
-
getMinRange
float getMinRange()
Get the minimum range at which this ability can be used.- Specified by:
getMinRangein interfaceIAbilityAction- Returns:
- Minimum range in blocks at which this action can be used.
-
setMinRange
void setMinRange(float range)
Set the minimum range.- Parameters:
range- Minimum range in blocks.
-
getMaxRange
float getMaxRange()
Get the maximum range at which this ability can be used.- Specified by:
getMaxRangein interfaceIAbilityAction- Returns:
- Maximum range in blocks at which this action can be used.
-
setMaxRange
void setMaxRange(float range)
Set the maximum range.- Parameters:
range- Maximum range in blocks.
-
getCooldownTicks
int getCooldownTicks()
Get the cooldown time in ticks.- Specified by:
getCooldownTicksin interfaceIAbilityAction- Returns:
- Cooldown duration in ticks after this action is used.
-
setCooldownTicks
void setCooldownTicks(int ticks)
Set the cooldown time in ticks.- Parameters:
ticks- Cooldown duration in ticks.
-
getWindUpTicks
int getWindUpTicks()
Get the wind-up time in ticks (telegraph phase).- Returns:
- wind-up time in ticks
-
setWindUpTicks
void setWindUpTicks(int ticks)
Set the wind-up time in ticks.- Parameters:
ticks- Wind-up duration in ticks.
-
getDazedTicks
int getDazedTicks()
Get the dazed time in ticks (stun after interrupt during WINDUP).- Returns:
- dazed time in ticks
-
setDazedTicks
void setDazedTicks(int ticks)
Set the dazed time in ticks.- Parameters:
ticks- Dazed duration in ticks.
-
isInterruptible
boolean isInterruptible()
Check if this ability can be interrupted by damage.- Returns:
- true if interruptible
-
setInterruptible
void setInterruptible(boolean interruptible)
Set whether this ability can be interrupted.- Parameters:
interruptible- Whether the ability is interruptible.
-
isIgnoreIFrames
boolean isIgnoreIFrames()
Check if this ability ignores target invulnerability frames (hurt resistance).- Returns:
- true if ignoring invulnerability frames
-
setIgnoreIFrames
void setIgnoreIFrames(boolean ignore)
Set whether this ability ignores target invulnerability frames (hurt resistance).- Parameters:
ignore- Whether to ignore invulnerability frames.
-
getLockMovementType
int getLockMovementType()
Get the lock movement type for this ability.- Returns:
- 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
-
setLockMovementType
void setLockMovementType(int type)
Set the lock movement type for this ability.- Parameters:
type- 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
-
getRotationModeType
int getRotationModeType()
Get the rotation mode for this ability.- Returns:
- 0=FREE, 1=LOCKED, 2=TRACK
-
setRotationModeType
void setRotationModeType(int type)
Set the rotation mode for this ability.- Parameters:
type- 0=FREE, 1=LOCKED, 2=TRACK
-
getRotationPhaseType
int getRotationPhaseType()
Get the rotation phase for this ability (when rotation mode applies).- Returns:
- 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
-
setRotationPhaseType
void setRotationPhaseType(int type)
Set the rotation phase for this ability.- Parameters:
type- 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
-
getTrackSpeedValue
float getTrackSpeedValue()
Get track speed for TRACK rotation mode (blocks/second). 0 = instant tracking. Comparable to player sprint speed (~5.6 blocks/sec).- Returns:
- track speed in blocks/second
-
setTrackSpeedValue
void setTrackSpeedValue(float speed)
Set track speed for TRACK rotation mode (blocks/second).- Parameters:
speed- 0 = instant tracking. ~4 = dodgeable while sprinting. ~6 = barely undodgeable.
-
isMovementLockedDuringWindup
boolean isMovementLockedDuringWindup()
Check if movement (pathfinding/motion) is locked during the WINDUP phase.- Returns:
- true if movement is locked during windup
-
isMovementLockedDuringActive
boolean isMovementLockedDuringActive()
Check if movement (pathfinding/motion) is locked during the ACTIVE phase.- Returns:
- true if movement is locked during active phase
-
isRotationLockedDuringWindup
boolean isRotationLockedDuringWindup()
Check if rotation (yaw/pitch) is locked during the WINDUP phase.- Returns:
- true if rotation is locked during windup
-
isRotationLockedDuringActive
boolean isRotationLockedDuringActive()
Check if rotation (yaw/pitch) is locked during the ACTIVE phase.- Returns:
- true if rotation is locked during active phase
-
isExecuting
boolean isExecuting()
Check if this ability is currently being executed.- Returns:
- true if currently executing
-
getPhaseInt
int getPhaseInt()
Get the current execution phase (0=IDLE, 1=WINDUP, 2=ACTIVE, 3=DAZED, 4=BURST_DELAY).- Returns:
- the current phase ordinal
-
getCurrentTick
int getCurrentTick()
Get the current tick within the current phase.- Returns:
- the current tick within the phase
-
getAllowedByType
int getAllowedByType()
Get the allowed user type for this ability.- Returns:
- 0=NPC_ONLY, 1=PLAYER_ONLY, 2=BOTH
-
setAllowedByType
void setAllowedByType(int type)
Set the allowed user type for this ability.- Parameters:
type- 0=NPC_ONLY, 1=PLAYER_ONLY, 2=BOTH
-
isIgnoreCooldown
boolean isIgnoreCooldown()
Check if this ability ignores cooldowns.- Returns:
- true if ignoring cooldowns
-
setIgnoreCooldown
void setIgnoreCooldown(boolean ignore)
Set whether this ability ignores cooldowns.- Parameters:
ignore- Whether to ignore cooldowns.
-
isPerAbilityCooldown
boolean isPerAbilityCooldown()
Check if this ability uses per-ability cooldown instead of global cooldown. When true, using this ability only puts THIS ability on cooldown, not all abilities.- Returns:
- true if using per-ability cooldown
-
setPerAbilityCooldown
void setPerAbilityCooldown(boolean perAbility)
Set whether this ability uses per-ability cooldown.- Parameters:
perAbility- Whether to use per-ability cooldown.
-
getNbt
INbt getNbt()
Get this ability's data as NBT.- Returns:
- the ability's NBT data
-
setNbt
void setNbt(INbt nbt)
Set this ability's data from NBT.- Parameters:
nbt- NBT data to load.
-
isBurstEnabled
boolean isBurstEnabled()
- Returns:
- Whether burst firing is enabled (fires multiple instances in rapid succession).
-
setBurstEnabled
void setBurstEnabled(boolean enabled)
- Parameters:
enabled- Whether burst firing is enabled.
-
getBurstAmount
int getBurstAmount()
- Returns:
- Number of times the ability fires per burst.
-
setBurstAmount
void setBurstAmount(int amount)
- Parameters:
amount- Number of shots per burst.
-
getBurstDelay
int getBurstDelay()
- Returns:
- Delay in ticks between each burst shot.
-
setBurstDelay
void setBurstDelay(int delay)
- Parameters:
delay- Delay in ticks between burst shots.
-
isBurstReplayAnimations
boolean isBurstReplayAnimations()
- Returns:
- Whether animations replay for each burst shot.
-
setBurstReplayAnimations
void setBurstReplayAnimations(boolean replay)
- Parameters:
replay- Whether to replay animations per burst shot.
-
isBurstOverlap
boolean isBurstOverlap()
- Returns:
- Whether burst shots can overlap (fire before previous shot ends).
-
setBurstOverlap
void setBurstOverlap(boolean overlap)
- Parameters:
overlap- Whether burst shots can overlap.
-
isToggleable
boolean isToggleable()
Check if this ability is toggleable (has at least 1 toggle state).- Returns:
- true if toggleable
-
getToggleStates
int getToggleStates()
Get the number of toggle states. 0 = not toggleable, 1 = binary on/off, 2+ = multi-state cycling.- Returns:
- number of toggle states
-
setToggleStates
void setToggleStates(int states)
Set the number of toggle states. 0 = not toggleable, 1 = binary on/off, 2+ = multi-state cycling.- Parameters:
states- Number of toggle states.
-
getToggleStateLabel
String getToggleStateLabel(int state)
Get the display label for a specific toggle state (1-indexed).- Parameters:
state- Toggle state number (1-indexed).- Returns:
- the label, or null if none set.
-
getMagicData
IMagicData getMagicData()
Get this ability's magic data. Defines magic types, damage splits, and flat magic damage for this ability. Inherited by spawned energy entities.- Returns:
- the ability's magic data
-
-