The Alteration Effects module contains a set of status effects (buffs and debuffs) that can alter a player's base state in some fashion.
These are the AlterationEffects that current exist in the module:
HealthBoostAlterationEffect- increases the maximum health of the player by a specified amountWaterBreathingAlterationEffect- allows the player to breathe in water i.e. they do not take damage from staying in the water for too longDamageOverTimeAlterationEffect- deals damage of a specified amount to the player at regular intervalsCureAllDamageOverTimeAlterationEffect- removes any damage over time effect on the play immediatelyCureDamageOverTimeAlterationEffect- counteracts damage dealt by any damage over time effect on the playerDecoverAlterationEffect- prevents the player from healing from any sourceRegenerationAlterationEffect- heals the entity for a specified amount at regular time intervalsResistDamageAlterationEffect- reduces damage dealt of a specific type to the player by a specified amountGlueAlterationEffect- reduces the player's movement speed by 10% and prevents them from jumpingItemUseSpeedAlterationEffect- reduces cooldowns on items used by the player for a specified amountJumpSpeedAlterationEffect- increases the speed of the player's jump by a specified amount i.e. they jump higherMultiJumpAlterationEffect- allows to player to multi-jump in the iar for a specified nuber of timesStunAlterationEffect- prevents the player from moving or jumpingSwimSpeedAlterationEffect- increases the speed with which the players swims by a specified amountWalkSpeedAlterationEffect- increases the speed with which the player walks by a specified amount
All AlterationEffect objects have two methods that you can use to apply the effects:
applyEffect(EntityRef instigator, EntityRef entity, float magnitude, long duration)
applyEffect(EntityRef instigator, EntityRef entity, String id, float magnitude, long duration)
instigator - the entity which applies the effect
entity - the entity the effect is applied on
magnitude - the magnitude of the effect
duration - the duration of the effect, in milliseconds
id - an optional ID for certain effects which require them (e.g. ResistDamage)
Not all alteration effects will make use of all these parameters. Take a look at the individual classes to see which parameters are used and how.
The following example shows how you can initialise a StunAlterationEffect object and apply it on an entity.
@In
private Context context
public void applyStunEffect(EntityRef instigator, EntityRef player) {
StunAlterationEffect stunAlterationEffect = new StunAlterationEffect(context);
//the instigator applies a stun effect on the player for 10 seconds
//the magnitude parameter is not used by StunAlterationEffect
applyEffect(instigator, player, 0, 10000);
}