public/js-roguelike-skeleton/src/valid-targets-finder.js
function(game, settings){
        this.game = game;

        settings = settings || {};

        this.x                          = settings.x                            || this.x;
        this.y                          = settings.y                            || this.y;
        this.limitToFov                 = settings.limitToFov                   || this.limitToFov;
        this.limitToNonDiagonalAdjacent = settings.limitToNonDiagonalAdjacent   || this.limitToNonDiagonalAdjacent;
        this.range                      = settings.range                        || this.range;
        this.validTypes                 = settings.validTypes                   || [];
        this.includeTiles               = settings.includeTiles                 || this.includeTiles;
        this.includeSelf                = settings.includeSelf                  || this.includeSelf;
        this.prepareValidTargets        = settings.prepareValidTargets          || this.prepareValidTargets;
        this.filter                     = settings.filter                       || this.filter;
    }
function(game, settings){
        this.game = game;

        settings = settings || {};

        this.x                          = settings.x                            || this.x;
        this.y                          = settings.y                            || this.y;
        this.limitToFov                 = settings.limitToFov                   || this.limitToFov;
        this.limitToNonDiagonalAdjacent = settings.limitToNonDiagonalAdjacent   || this.limitToNonDiagonalAdjacent;
        this.range                      = settings.range                        || this.range;
        this.validTypes                 = settings.validTypes                   || [];
        this.includeTiles               = settings.includeTiles                 || this.includeTiles;
        this.includeSelf                = settings.includeSelf                  || this.includeSelf;
        this.prepareValidTargets        = settings.prepareValidTargets          || this.prepareValidTargets;
        this.filter                     = settings.filter                       || this.filter;
    }
function ( game , settings ) { this . game = game ; settings = settings || { } ; this . x = settings . x || this . x ; this . y = settings . y || this . y ; this . limitToFov = settings . limitToFov || this . limitToFov ; this . limitToNonDiagonalAdjacent = settings . limitToNonDiagonalAdjacent || this . limitToNonDiagonalAdjacent ; this . range = settings . range || this . range ; this . validTypes = settings . validTypes || [ ] ; this . includeTiles = settings . includeTiles || this . includeTiles ; this . includeSelf = settings . includeSelf || this . includeSelf ; this . prepareValidTargets = settings . prepareValidTargets || this . prepareValidTargets ; this . filter = settings . filter || this . filter ; }
Gets a list of valid targets filtered by provided criteria.
@class ValidTargetsFinder
@constructor
@param {Game}         game
@param {Object}       settings
@param {Number}       settings.x                                  - The x map tile coord to use as the origin of the attack.
@param {Number}       settings.y                                  - The y map tile coord to use as the origin of the attack.
@param {FovROT}       [settings.limitToFov=false]                 - If set only targets within the given `FovROT` will be valid.
@param {Bool}         [settings.limitToNonDiagonalAdjacent=false] - If true diagonally adjacent targets are not valid (only used if `range = 1`).
@param {Number}       [settings.range=1]                          - Max distance in tiles target can be from origin.
@param {Array}        [settings.validTypes=Array]                 - Array of valid target object types. Checked using `target instanceof type`.
@param {Bool}         [settings.includeTiles=false]               - If true tile objects are can be valid targets.
@param {Object|Array} [settings.exclude=false]                    - Object or Array of objects to exclude from results.
@param {Bool}         [settings.prepareValidTargets=true]         - If true valid targets are wraped in an object with x, y, range, value properties.
@param {Function}     [settings.filter=false]                     - Function to filter objects when checking if they are valid. `function(obj){ return true }` . Targets must still be a valid type.
Gets a list of valid targets filtered by provided criteria .