Class Effect
java.lang.Object
de.gurkenlabs.litiengine.abilities.effects.Effect
- All Implemented Interfaces:
IUpdateable
- Direct Known Subclasses:
AttributeEffect
,ForceEffect
,SoundEffect
public abstract class Effect
extends java.lang.Object
implements IUpdateable
The Class Effect seeks for affected entities in the game's current
environment to apply certain effects to them defined by the overwritten
implementation of apply/cease.
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Effect.EffectAppliedListener
static interface
Effect.EffectCeasedListener
Constructor Summary
Constructors Modifier Constructor Description protected
Effect(Ability ability, EffectTarget... targets)
Method Summary
Modifier and Type Method Description protected void
apply(ICombatEntity entity)
void
apply(java.awt.Shape impactArea)
Applies the effect in the specified impact area on the specified environment.protected boolean
canAttackEntity(ICombatEntity entity)
protected void
cease(EffectApplication appliance)
void
cease(ICombatEntity entity)
protected boolean
customTarget(ICombatEntity entity)
Overwrite this method to implement a custom target predicate that determines whether an entity can be affected by this effect.Ability
getAbility()
java.util.List<EffectApplication>
getActiveAppliances()
int
getDelay()
int
getDuration()
EffectTarget[]
getEffectTargets()
protected java.util.Collection<ICombatEntity>
getEntitiesInImpactArea(java.awt.Shape impactArea)
java.util.List<Effect>
getFollowUpEffects()
RelativeEntityComparator
getTargetPriorityComparator()
protected long
getTotalDuration()
protected boolean
hasEnded(EffectApplication appliance)
boolean
isActive(ICombatEntity entity)
protected boolean
isAliveFriendlyEntity(ICombatEntity entity)
protected boolean
isDeadFriendlyEntity(ICombatEntity entity)
protected java.util.List<ICombatEntity>
lookForAffectedEntities(java.awt.Shape impactArea)
void
onEffectApplied(Effect.EffectAppliedListener listener)
void
onEffectCeased(Effect.EffectCeasedListener listener)
void
removeEffectAppliedListener(Effect.EffectAppliedListener listener)
void
removeEffectCeasedListener(Effect.EffectCeasedListener listener)
void
setDelay(int delay)
void
setDuration(int duration)
void
setTargetPriorityComparator(RelativeEntityComparator targetPriorityComparator)
void
update()
1.
Constructor Details
Method Details
onEffectApplied
removeEffectAppliedListener
onEffectCeased
removeEffectCeasedListener
apply
public void apply(java.awt.Shape impactArea)Applies the effect in the specified impact area on the specified environment.- Parameters:
impactArea
- The impact area
cease
getAbility
getActiveAppliances
getDelay
public int getDelay()getDuration
public int getDuration()getEffectTargets
getFollowUpEffects
getTargetPriorityComparator
isActive
setDelay
public void setDelay(int delay)setDuration
public void setDuration(int duration)setTargetPriorityComparator
update
public void update()1. Cease the effect after its duration. 2. apply all follow up effects 3. remove appliance 4. unregister from loop if all appliances are done- Specified by:
update
in interfaceIUpdateable
- See Also:
ClientConfiguration.setMaxFps(int)
apply
cease
getEntitiesInImpactArea
getTotalDuration
protected long getTotalDuration()hasEnded
lookForAffectedEntities
customTarget
Overwrite this method to implement a custom target predicate that determines whether an entity can be affected by this effect. The targets of this effect need to include theCUSTOM
value in order for this function to be evaluated.- Parameters:
entity
- The entity to check against the custom target predicate.- Returns:
- True if the entity can be affected by this effect; otherwise false.
- See Also:
EffectTarget.CUSTOM
canAttackEntity
isAliveFriendlyEntity
isDeadFriendlyEntity