API Docs for:
Show:

File: gameplay\health\Components.js

/**
 A component class holding the health and base resistances.
 @class Health
 @constructor
 @param maximumHealth {Number} Entity's maximum health.
 @param baseCyanResistance {Number} Base resistance to cyan damage. Resistances should be from 0 to 1, where 0 means no resistance and 1 means full resistance.
 @param baseMagentaResistance {Number} Base resistance to magenta damage.  Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
 @param baseYellowResistance {Number} Base resistance to yellow damage.  Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
 @param baseWhiteResistance {Number} Base resistance to white damage.  Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
 */
function Health(maximumHealth, baseCyanResistance, baseMagentaResistance, baseYellowResistance, baseWhiteResistance){
    this._maximumHealth = maximumHealth || 0;
    this._currentHealth = this._maximumHealth;
    
    this._baseCyanResistance = baseCyanResistance || 0;
    this._baseMagentaResistance = baseMagentaResistance || 0;
    this._baseYellowResistance = baseYellowResistance || 0;
    this._baseWhiteResistance = baseWhiteResistance || 0;
}

Health.prototype = {
    constructor : Health,
    _componentIdentifier : 0,

    /**
     @method getCurrentHealth
     @return {Number}
     */
    getCurrentHealth : function(){
        return this._currentHealth;
    },
    
    /**
     @method getMaximumHealth
     @return {Number}
     */
    getMaximumHealth : function(){
        return this._maximumHealth;
    },
    
    /**
     @method setMaximumHealth
     @param maximumHealth {Number}
     */
    setMaximumHealth : function(maximumHealth){
        this._maximumHealth = maximumHealth;
    },
    
    /**
     @method getBaseCyanResistance
     @return {Number}
     */
    getBaseCyanResistance : function(){
        return this._baseCyanResistance;
    },
    
    /**
     @method setBaseCyanResistance
     @param baseCyanResistance {Number} Base resistance to cyan damage. Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
     */
    setBaseCyanResistance : function(baseCyanResistance){
        this._baseCyanResistance = baseCyanResistance;
    },
    
    /**
     @method getBaseMagentaResistance
     @return {Number}
     */
    getBaseMagentaResistance : function(){
        return this._baseMagentaResistance;
    },
    
    /**
     @method setBaseMagentaResistance
     @param baseMagentaResistance {Number} Base resistance to magenta damage. Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
     */
    setBaseMagentaResistance : function(baseMagentaResistance){
        this._baseMagentaResistance = baseMagentaResistance;
    },
    
    /**
     @method getBaseYellowResistance
     @return {Number}
     */
    getBaseYellowResistance : function(){
        return this._baseYellowResistance;
    },
    
    /**
     @method setBaseYellowResistance
     @param baseYellowResistance {Number} Base resistance to yellow damage.  Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
     */
    setBaseYellowResistance : function(baseYellowResistance){
        this._baseYellowResistance = baseYellowResistance;
    },
    
    /**
     @method getBaseWhiteResistance
     @return {Number}
     */
    getBaseWhiteResistance : function(){
        return this._baseWhiteResistance;
    },
    
    /**
     @method setBaseWhiteResistance
     @param baseWhiteResistance {Number} Base resistance to white damage.  Resistances can be negative. Resistances are % based, where 0 means no resistance 1 means full resistance and -1 means that the entity will take double damage.
     */
    setBaseWhiteResistance : function(baseWhiteResistance){
        this._baseWhiteResistance = baseWhiteResistance;
    }
};