API Docs for:
Show:

File: gameplay\spell-casting\spell-effects\SpellEffects.js



//=====Movement spell effects=====

/**
 Spell effect that modifies movement speed. This effect stacks multiplicatively.
 @class MovementSpeedSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param speedMultiplier {Number} Multiplier used during movement impulse and maximum velocity calculation.
 */
function MovementSpeedSpellEffect(duration, speedMultiplier){
    this._durationRemaining = duration || 0;
    this._speedMultiplier = speedMultiplier || 0;
}

MovementSpeedSpellEffect.prototype = {
    constructor : MovementSpeedSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getSpeedMultiplier
     @return {Number}
     */
    getSpeedMultiplier : function(){
        return this._speedMultiplier;
    }
};

/**
 Spell effect that modifies jump power. This effect stacks multiplicatively.
 @class JumpPowerSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param jumpPowerMultiplier {Number} Multiplier used during jump impulse calculation.
 */
function JumpPowerSpellEffect(duration, jumpPowerMultiplier){
    this._durationRemaining = duration || 0;
    this._jumpPowerMultiplier = jumpPowerMultiplier || 0;
}

JumpPowerSpellEffect.prototype = {
    constructor : JumpPowerSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getJumpPowerMultiplier
     @return {Number}
     */
    getJumpPowerMultiplier : function(){
        return this._jumpPowerMultiplier;
    }
};


//=====Health spell effects=====

/**
 Spell effect that modifies damage resistances. This effect stacks additively up to 1 for a given damage resistance.
 @class ResistanceSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param resistanceAmount {Number} This value can be negative. The amount is % based, where 0 means no resistance, 1 means full resistance and -1 means that the entity will take double damage.
 @param resistanceType {String} Type can be 'c' for cyan, 'm' for magenta, 'y' for yellow and 'w' for white.
 */
function ResistanceSpellEffect(duration, resistanceAmount, resistanceType){
    this._durationRemaining = duration || 0;
    this._resistanceAmount = resistanceAmount || 0;
    this._resistanceType = resistanceType || null;
}

ResistanceSpellEffect.prototype = {
    constructor : ResistanceSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getResistanceAmount
     @return {Number}
     */
    getResistanceAmount : function(){
        return this._resistanceAmount;
    },
    
    /**
     @method getResistanceType
     @return {String}
     */
    getResistanceType : function(){
        return this._resistanceType;
    }
};

/**
 Spell effect that adds a shield. This effect stacks additively. The last shield applied is the first one to be damaged.
 Shields protect against all types of damage.
 @class ShieldSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param absorbtionAmount {Number} Amount of damage this shield can absorb before it's dispelled.
 */
function ShieldSpellEffect(duration, absorbtionAmount){
    this._durationRemaining = duration || 0;
    this._absorbtionAmountRemaining = absorbtionAmount || 0;
}

ShieldSpellEffect.prototype = {
    constructor : ShieldSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getAbsorbtionAmountRemaining
     @return {Number} Amount of damage this shield can still absorb.
     */
    getAbsorbtionAmountRemaining : function(){
        return this._absorbtionAmountRemaining;
    }
};

/**
 Spell effect that periodically deals damage to the entity. This effect stacks additively, where each effect is its own source of damage.
 @class DamageOverTimeSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param damageInterval {Number} How many seconds should pass between each instance of damage. The spell effect always deals its last tick of damage right before expiring, so a 15 second long DoT with a 3 second interval will deal damage at 12 seconds remaining, then 9, then 6, then 3, then 0.
 @param damageAmount {Number} Amount of damage dealt per interval.
 @param damageType {String} Type can be 'c' for cyan, 'm' for magenta, 'y' for yellow and 'w' for white.
 */
function DamageOverTimeSpellEffect(duration, damageInterval, damageAmount, damageType){
    this._durationRemaining = duration || 0;
    this._damageInterval = damageInterval || 0;
    this._damageAmount = damageAmount || 0;
    this._damageType = damageType || null;
}

DamageOverTimeSpellEffect.prototype = {
    constructor : DamageOverTimeSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getDamageInterval
     @return {Number}
     */
    getDamageInterval : function(){
        return this._damageInterval;
    },
    
    /**
     @method getDamageAmount
     @return {Number}
     */
    getDamageAmount : function(){
        return this._damageAmount;
    },
    
    /**
     @method getDamageType
     @return {String}
     */
    getDamageType : function(){
        return this._damageType;
    }
};

/**
 Spell effect that periodically heals the entity. This effect stacks additively, where each effect is its own source of healing.
 @class HealingOverTimeSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param healingInterval {Number} How many seconds should pass between each instance of healing. The spell effect always heals the last tick right before expiring, so a 15 second long DoT with a 3 second interval will heal at 12 seconds remaining, then 9, then 6, then 3, then 0.
 @param healingAmount {Number} Amount of healing per interval.
 */
function HealingOverTimeSpellEffect(duration, healingInterval, healingAmount){
    this._durationRemaining = duration || 0;
    this._healingInterval = healingInterval || 0;
    this._healingAmount = healingAmount || 0;
}

HealingOverTimeSpellEffect.prototype = {
    constructor : HealingOverTimeSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getHealingInterval
     @return {Number}
     */
    getHealingInterval : function(){
        return this._healingInterval;
    },
    
    /**
     @method getHealingAmount
     @return {Number}
     */
    getHealingAmount : function(){
        return this._healingAmount;
    }
};


//=====Attack spell effects=====

/**
 Spell effect that modifies attack speed. This effect stacks multiplicatively.
 @class AttackSpeedSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param speedMultiplier {Number} Multiplier used during attack cooldown calculation.
 */
function AttackSpeedSpellEffect(duration, speedMultiplier){
    this._durationRemaining = duration || 0;
    this._speedMultiplier = speedMultiplier || 0;
}

AttackSpeedSpellEffect.prototype = {
    constructor : AttackSpeedSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getSpeedMultiplier
     @return {Number}
     */
    getSpeedMultiplier : function(){
        return this._speedMultiplier;
    }
};

/**
 Spell effect that triggers a spell cast next time the entity attacks. It prevents a regular attack from triggering, but sets an attack
 cooldown. Only one attack enchant can be present on an entity at a time.
 @class AttackEnchantSpellEffect
 @constructor
 @param duration {Number} Effect duration in seconds. The clock starts ticking when the effect is applied.
 @param numberOfCharges {Number} Amount of times a spell can be triggered before this effect expires.
 @param spellTriggered {String} Name of the spell triggered.
 */
function AttackEnchantSpellEffect(duration, numberOfCharges, spellTriggered){
    this._durationRemaining = duration || 0;
    //A charge is used when an attack is performed.
    this._numberOfChargesRemaining = numberOfCharges || 0;
    //String with the name of the spell that will be triggered on weapon hit.
    this._spellTriggered = spellTriggered || null;
}

AttackEnchantSpellEffect.prototype = {
    constructor : AttackEnchantSpellEffect,
    
    /**
     @method getDurationRemaining
     @return {Number} Number of seconds remaining before this effect expires.
     */
    getDurationRemaining : function(){
        return this._durationRemaining;
    },
    
    /**
     @method getNumberOfChargesRemaining
     @return {Number}
     */
    getNumberOfChargesRemaining : function(){
        return this._numberOfChargesRemaining;
    },
    
    /**
     @method getSpellTriggered
     @return {String}
     */
    getSpellTriggered : function(){
        return this._spellTriggered;
    }
};