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 IUpdateableThe 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 interfaceEffect.EffectAppliedListenerstatic interfaceEffect.EffectCeasedListenerConstructor Summary
Constructors Modifier Constructor Description protectedEffect(Ability ability, EffectTarget... targets)Method Summary
Modifier and Type Method Description protected voidapply(ICombatEntity entity)voidapply(java.awt.Shape impactArea)Applies the effect in the specified impact area on the specified environment.protected booleancanAttackEntity(ICombatEntity entity)protected voidcease(EffectApplication appliance)voidcease(ICombatEntity entity)protected booleancustomTarget(ICombatEntity entity)Overwrite this method to implement a custom target predicate that determines whether an entity can be affected by this effect.AbilitygetAbility()java.util.List<EffectApplication>getActiveAppliances()intgetDelay()intgetDuration()EffectTarget[]getEffectTargets()protected java.util.Collection<ICombatEntity>getEntitiesInImpactArea(java.awt.Shape impactArea)java.util.List<Effect>getFollowUpEffects()RelativeEntityComparatorgetTargetPriorityComparator()protected longgetTotalDuration()protected booleanhasEnded(EffectApplication appliance)booleanisActive(ICombatEntity entity)protected booleanisAliveFriendlyEntity(ICombatEntity entity)protected booleanisDeadFriendlyEntity(ICombatEntity entity)protected java.util.List<ICombatEntity>lookForAffectedEntities(java.awt.Shape impactArea)voidonEffectApplied(Effect.EffectAppliedListener listener)voidonEffectCeased(Effect.EffectCeasedListener listener)voidremoveEffectAppliedListener(Effect.EffectAppliedListener listener)voidremoveEffectCeasedListener(Effect.EffectCeasedListener listener)voidsetDelay(int delay)voidsetDuration(int duration)voidsetTargetPriorityComparator(RelativeEntityComparator targetPriorityComparator)voidupdate()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:
updatein 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 theCUSTOMvalue 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
