Interface ICombatEntity
- All Superinterfaces:
ICollisionEntity,IEntity
- All Known Implementing Classes:
CombatEntity,Creature,Prop
The ICombatEntity interface defines the methods required for an entity that can engage in combat. It extends the ICollisionEntity interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCombatEntityListener(CombatEntityListener listener) Adds a CombatEntityListener to this entity.voiddie()Causes this entity to die.Gets the list of effects currently applied to this entity.Gets the hit box of this entity.Gets the hit points of this entity.Gets the current target of this entity.intgetTeam()Gets the team of this entity.voidhit(int damage) Inflicts damage to this entity.voidInflicts damage to this entity with a specific ability.booleanisDead()Checks if this entity is dead.booleanisFriendly(ICombatEntity entity) Checks if this entity is friendly to another entity.booleanChecks if this entity is indestructible.booleanChecks if this entity is neutral.voidonDeath(CombatEntityDeathListener listener) Registers a listener to be called when this entity dies.voidonHit(CombatEntityHitListener listener) Registers a listener to be called when this entity is hit.voidonResurrect(CombatEntityResurrectListener listener) Registers a listener to be called when this entity is resurrected.voidRemoves a CombatEntityListener from this entity.voidremoveListener(CombatEntityDeathListener listener) Removes a death listener from this entity.voidremoveListener(CombatEntityHitListener listener) Removes a hit listener from this entity.voidremoveListener(CombatEntityResurrectListener listener) Removes a resurrect listener from this entity.voidResurrects this entity.voidsetIndestructible(boolean indestructible) Sets the indestructible state of this entity.voidsetTarget(ICombatEntity target) Sets the target of this entity.voidsetTeam(int team) Sets the team of this entity.booleanwasHit(int timeSpan) Checks if this entity was hit within a specific time span.Methods inherited from interface de.gurkenlabs.litiengine.entities.ICollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionTypeMethods inherited from interface de.gurkenlabs.litiengine.entities.IEntity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, detachControllers, getAngle, getBoundingBox, getCenter, getController, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, renderWithLayer, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setVisible, setWidth, setX, setY
-
Method Details
-
addCombatEntityListener
Adds a CombatEntityListener to this entity.- Parameters:
listener- the listener to add
-
removeCombatEntityListener
Removes a CombatEntityListener from this entity.- Parameters:
listener- the listener to remove
-
onHit
Registers a listener to be called when this entity is hit.- Parameters:
listener- the listener to register
-
removeListener
Removes a hit listener from this entity.- Parameters:
listener- the listener to remove
-
onDeath
Registers a listener to be called when this entity dies.- Parameters:
listener- the listener to register
-
removeListener
Removes a death listener from this entity.- Parameters:
listener- the listener to remove
-
onResurrect
Registers a listener to be called when this entity is resurrected.- Parameters:
listener- the listener to register
-
removeListener
Removes a resurrect listener from this entity.- Parameters:
listener- the listener to remove
-
die
void die()Causes this entity to die. -
getAppliedEffects
Gets the list of effects currently applied to this entity.- Returns:
- a list of applied effects
-
getHitPoints
RangeAttribute<Integer> getHitPoints()Gets the hit points of this entity.- Returns:
- the hit points as a RangeAttribute
-
getHitBox
Shape getHitBox()Gets the hit box of this entity.- Returns:
- the hit box as a Shape
-
getTarget
ICombatEntity getTarget()Gets the current target of this entity.- Returns:
- the target entity
-
getTeam
int getTeam()Gets the team of this entity.- Returns:
- the team as an integer
-
hit
void hit(int damage) Inflicts damage to this entity.- Parameters:
damage- the amount of damage to inflict
-
hit
Inflicts damage to this entity with a specific ability.- Parameters:
damage- the amount of damage to inflictability- the ability causing the damage
-
isDead
boolean isDead()Checks if this entity is dead.- Returns:
- true if the entity is dead, false otherwise
-
isFriendly
Checks if this entity is friendly to another entity.- Parameters:
entity- the entity to check against- Returns:
- true if the entity is friendly, false otherwise
-
isIndestructible
boolean isIndestructible()Checks if this entity is indestructible.- Returns:
- true if the entity is indestructible, false otherwise
-
isNeutral
boolean isNeutral()Checks if this entity is neutral.- Returns:
- true if the entity is neutral, false otherwise
-
resurrect
void resurrect()Resurrects this entity. -
setIndestructible
void setIndestructible(boolean indestructible) Sets the indestructible state of this entity.- Parameters:
indestructible- the indestructible state to set
-
setTarget
Sets the target of this entity.- Parameters:
target- the target entity to set
-
setTeam
void setTeam(int team) Sets the team of this entity.- Parameters:
team- the team to set
-
wasHit
boolean wasHit(int timeSpan) Checks if this entity was hit within a specific time span.- Parameters:
timeSpan- the time span to check- Returns:
- true if the entity was hit within the time span, false otherwise
-