Members
-
activateCastSettings
-
Show pow effect if melee is successful.
- Source:
-
activated :Boolean
-
Whether ability has been activated.
- Inherited From:
- Default Value:
- false
- Source:
-
activatePassCastSettings :Object
-
Activate checks pass cast settings.
- Inherited From:
- Default Value:
- null
- Source:
- See:
-
activateSetupCastSettings
-
Cast melee animation to setup.
- Source:
-
activateStrict :Boolean
-
Whether ability should check distance twice during activate process. IMPORTANT: this only applies when casting!
- Inherited From:
- Default Value:
- true
- Source:
-
activateToggle :Boolean
-
Whether ability should toggle activate / deactivate instead of just activating.
- Inherited From:
- Default Value:
- false
- Source:
-
autoStopMoving :Boolean
-
Whether ability should automatically force the entity to stop moving so it won't interrupt itself immediately.
- Inherited From:
- Default Value:
- true
- Source:
-
blocking :Boolean
-
Whether ability blocks other abilities of lower ig.Ability#priority when this ability is activated first via ig.Hierarchy#activate.
- Inherited From:
- Default Value:
- true
- Source:
// if a character has two abilities character.abilityA = new ig.Ability( character ); character.abilityB = new ig.Ability( character ); // and these are added to the character's abilities list character.abilities.addDescendants( [ character.abilityA, character.abilityB ] ); // when abilities are all activated together character.abilities.activate( target ); // we can set abilities to block // the execution of all lower priority abilities // for example, to block B from executing if A is activated successfully // (assuming A priority is > B priority) character.abilityA.blocking = true;
-
canFindTarget
-
Ability should find target automatically.
- Default Value:
- true
- Source:
-
canTargetFixed :Boolean
-
Whether can target fixed entities (usually UI elements).
- Inherited From:
- Default Value:
- false
- Source:
-
canTargetOthers :Boolean
-
Whether can target others.
- Inherited From:
- Default Value:
- true
- Source:
-
canTargetSelf :Boolean
-
Damaging ability should not target self.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> casting :Boolean
-
Whether to ability is casting.
- Inherited From:
- Default Value:
- false
- Source:
-
castTimer :ig.Timer
-
Timer for casting.
- created on init- Inherited From:
- Source:
-
channelled :Boolean
-
Whether ability is channelled after activated.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> channelling :Boolean
-
Whether ability is currently channelling.
- Inherited From:
- Default Value:
- false
- Source:
-
cooldownDelay
-
Melee has a short cooldown.
- Default Value:
- 0.2
- Source:
-
cooldownTimer :ig.Timer
-
Timer for cooldown.
- created on init- Inherited From:
- Source:
-
costActivate :Number
-
Energy cost to activate.
- Inherited From:
- Default Value:
- 0
- Source:
-
costChannel :Number
-
Energy cost to channel.
- Inherited From:
- Default Value:
- 0
- Source:
-
damage :Number
-
Damage done.
- Inherited From:
- Default Value:
- 1
- Source:
-
damageAsPct :Boolean
-
Damage done in pct of target's health.
- Inherited From:
- Default Value:
- false
- Source:
-
damageUnblockable :Boolean
-
Force damage through all defenses.
- Inherited From:
- Default Value:
- false
- Source:
-
deactivateCastSettings :Object
-
Deactivate cast settings.
- Inherited From:
- Default Value:
- null
- Source:
- See:
-
deactivateSetupCastSettings :Object
-
Deactivate setup cast settings.
- Inherited From:
- Default Value:
- null
- Source:
- See:
-
delayedLevel :Object
-
If an ig.game.loadLevel was delayed because preloader wasn't ready, contains the object of the level.
- created on init.- Inherited From:
- Source:
-
delayedSpawnerName :string
-
If an ig.game.loadLevel was delayed because preloader wasn't ready, contains the name of the spawning entity.
- created on init.- Inherited From:
- Source:
-
enabled :Boolean
-
Whether ability is able to activate.
- Inherited From:
- Default Value:
- true
- Source:
-
entity :ig.EntityExtended
-
Entity that is using this ability.
- Inherited From:
- Default Value:
- null
- Source:
-
entityOptions :ig.EntityExtended
-
Entity that provides options / settings for ability use.
- Inherited From:
- Default Value:
- null
- Source:
-
entityTarget :ig.EntityExtended
-
Entity that is the target of this ability
- Inherited From:
- Default Value:
- null
- Source:
-
faceTarget :Boolean
-
Whether to face target.
- Inherited From:
- Default Value:
- true
- Source:
-
failCastSettings :Object
-
Fail cast settings.
- Inherited From:
- Default Value:
- null
- Source:
- See:
-
failReason :String
-
Reason for ability failure.
- Inherited From:
- Source:
-
groupTargetable :Number
-
Flag for groups of entities that can be targeted. Tip: a target must match ALL groups in this flag!
- Inherited From:
- Default Value:
- 0
- Source:
- See:
-
- ig.utils#addType
- ig.EntityExtended
// target any group except for own group ability.groupTargetable = 0; // target enemy ig.utils.addType( ig.EntityExtended, ability, 'typeTargetable', 'ENEMY', 'GROUP' ); // target enemy zombies ig.utils.addType( ig.EntityExtended, ability, 'typeTargetable', 'ENEMY ZOMBIES', 'GROUP' );
-
id :String
-
Unique instance id.
- Inherited From:
- Source:
-
movable
-
Ability can be done while moving.
- Default Value:
- true
- Source:
-
name :String
-
Unique instance name.
- usually names are used to map instances for faster searching.- Inherited From:
- Source:
-
needsDeactivate :Boolean
-
Whether ability needs deactivate.
- Inherited From:
- Default Value:
- false
- Source:
-
onActivated :ig.Signal
-
Signal dispatched when ability activates.
- created on init.- Inherited From:
- Source:
-
once :Boolean
-
Whether ability should activate once and stay activated.
- Inherited From:
- Default Value:
- false
- Source:
-
onDeactivated :ig.Signal
-
Signal dispatched when ability deactivates.
- created on init.- Inherited From:
- Source:
-
onFailed :ig.Signal
-
Signal dispatched when ability fails a check.
- created on init.- Inherited From:
- Source:
-
onReady :ig.Signal
-
Signal dispatched when preloader had loaded everything queued.
- created on init.- Inherited From:
- Source:
-
paused :Boolean
-
Whether ability is paused.
- Inherited From:
- Default Value:
- false
- Source:
-
priority :Number
-
Priority of ability where higher is activated sooner when using ig.Hierarchy#activate.
- Inherited From:
- Default Value:
- 0
- Source:
// if a character has two abilities character.abilityA = new ig.Ability( character ); character.abilityB = new ig.Ability( character ); // and these are added to the character's abilities list character.abilities.addDescendants( [ character.abilityA, character.abilityB ] ); // when these abilities are all activated together character.abilities.activate( target ); // there is no guaranteed order of execution // though in this case it would likely be A then B // to change this order (or to guarantee order) use priorities // for example, to guarantee execution order of B then A character.abilityA.priority = 1; character.abilityB.priority = 0; // this only applies when these abilities are all activated together character.abilities.activate( target );
-
rangeX
-
Range is based on effective size of the base character. Generally, we want melee to have a bit larger range than what would be expected visually.
- Source:
-
rangeY :Number
-
Vertical distance for finding targets from ability user, or to determine if ability user is close enough to target.
- Inherited From:
- Default Value:
- 0
- Source:
// does not find targets and treats all targets as if within range ability.rangeY = 0;
-
rank :Number
-
Upgrade rank.
- Inherited From:
- Default Value:
- 0
- Source:
-
ready :boolean
-
Property to determine externally if the preloader has finished loading or not.
- created on init.- Inherited From:
- Source:
-
regenBlocking :Boolean
-
Whether blocks user from regenerating while channelling.
- Inherited From:
- Default Value:
- true
- Source:
-
requiresTarget :Boolean
-
Damaging ability needs a target.
- Inherited From:
- Default Value:
- true
- Source:
-
retainTarget :Boolean
-
Whether to retain target after execution.
- Inherited From:
- Default Value:
- false
- Source:
-
type :Number
-
Flag for type of ability.
- Inherited From:
- Default Value:
- 0
- Source:
- See:
-
- ig.utils#addType
-
typeTargetable :Number
-
Flag for types of entities that can be targeted. Tip: a target must match ALL types in this flag!
- Inherited From:
- Default Value:
- 0
- Source:
- See:
-
- ig.utils#addType
- ig.EntityExtended
// target any type ability.typeTargetable = 0; // target characters ig.utils.addType( ig.EntityExtended, ability, 'typeTargetable', 'CHARACTER' ); // target characters that are zombies ig.utils.addType( ig.EntityExtended, ability, 'typeTargetable', 'CHARACTER ZOMBIE' );
-
upgrades :Array
-
Upgrades to apply, where each index corresponds to a rank.
- Inherited From:
- Source:
Methods
-
activate()
-
Activates ability and starts activation process. Can also toggle between activate and deactivate using ig.Ability#activateToggle property. Tip: for best results, your custom ability should do all of its activate magic by overriding the ig.Ability#activateComplete method!
- Inherited From:
- Source:
-
activateComplete()
-
- Inherited From:
- Source:
-
activatePass()
-
Called when activate checks passed. Step 3 of activate process. Tip: for best results, your custom ability should do all of its activate magic by overriding the ig.Ability#activateComplete method!
- Inherited From:
- Source:
-
activatePlain()
-
Activate without any parameters, used when setting entity to activate passive abilities.
- Inherited From:
- Source:
-
activateSetup()
-
Sets up ability to activate. Step 1 of activate process. Tip: for best results, your custom ability should do all of its activate magic by overriding the ig.Ability#activateComplete method!
- Inherited From:
- Source:
-
activateTry()
-
Tries to activate by doing checks. Step 2 of activate process. Tip: for best results, your custom ability should do all of its activate magic by overriding the ig.Ability#activateComplete method!
- Inherited From:
- Source:
-
addUpgrades(upgrades)
-
Adds upgrades to the upgrades list, where each upgrade is mapped by index to a rank.
Parameters:Name Type Description upgrades
Object | function | Array object with properties to merge into this, a function to call upon upgrade, or an array of the previous. - Inherited From:
- Source:
-
assert(checkResult, failReason) → {Boolean}
-
Evaluates a check result and triggers fail if a check is false.
Parameters:Name Type Description checkResult
* result of a check evaluated as truthy or falsy. failReason
String reason assert may fail. - Inherited From:
- Source:
{ Boolean } Whether a check is true. -
blockRegen(entity)
-
Blocks energy regeneration in entity.
Parameters:Name Type Description entity
ig.EntityExtended block regeneration in this entity. - Inherited From:
- Source:
-
canPayCost() → {Boolean}
-
- Inherited From:
- Source:
{ Boolean } Whether entity can pay energy cost. -
cast(settings, internalCallback, internalArgs)
-
Casts using delay and/or animation and then does callback. IMPORTANT: casting only works when ability is also updated.
Parameters:Name Type Argument Description settings
Object settings for casting. internalCallback
function <optional>
internal callback. internalArgs
Array <optional>
internal arguments. - Inherited From:
- Source:
// cast settings is a plain object castSettings = {}; // casts based on 1 second delay castSettings.delay = 1; // add an animation to casting // which will loop until delay complete // if no delay is provided // cast will only last as long as animation castSettings.animName = 'casting'; // if the game is in top down mode // the anim name may be changed // based on the casting entity facing // i.e. "shoot" becomes "shootX" when facing x // i.e. "shoot" becomes "shootY" when facing y and can flip y // i.e. "shoot" becomes "shootUp" when facing up and CANNOT flip y // i.e. "shoot" becomes "shootDown" when facing down and CANNOT flip y // this behavior can be overriden by making the anim omni directional castSettings.animOmniDirectional = true; // casting is by default interrupted by any movement // but this can be changed in 2 ways // either set the ability to movable ability.movable = true; // or set the particular cast to movable castSettings.movable = true; // sometimes we want to cast // but we don't want the cast to block the ability activation process // i.e. this cast should be asynchronous castSettings.async = true; // when casting is complete, we can call a function castSettings.callback = function () { ... }; // in a context castSettings.context = someObject; // and pass a settings object to that callback castSettings.settings = {...}; // while casting, we can also add a list of effects castSettings.effects = [ // where each effect is spawned by a plain object { // that consists of an entity class to spawn as the effect // which will be automatically killed when casting is ended // (usually effects should be particles, so they are garaunteed to die) entityClass: ig.EntityClass // a settings object that will be merged into the spawned entity effect settings: {...}, // effect can ignore the duration of the cast // and live beyond the casting time ignoreDuration: true, // effect can be automatically faded // i.e. it will fade slowly from 1 to 0 over its life fade: true, // effects will default to follow the ability user // if follow settings are included // and these settings map to ig.EntityExtended's moveTo settings followSettings: {...}, // and effects can also follow the ability target followTarget: true } // and we can create as many effects as needed (but don't be a jerk and overload) ... ];
-
castComplete()
-
Completes casting.
- Inherited From:
- Source:
-
castEffects(settings)
-
Shows all effects for effects settings.
Parameters:Name Type Description settings
Object effects settings (i.e. castSettings.effects). - Inherited From:
- Source:
-
castEnd()
-
Ends casting.
- Inherited From:
- Source:
-
castStart(settings, internalCallback, internalArgs)
-
Starts casting.
Parameters:Name Type Argument Description settings
Object settings object. internalCallback
function <optional>
internal callback. internalArgs
Array <optional>
internal arguments. - Inherited From:
- Source:
-
castUpdate()
-
Updates casting.
- Inherited From:
- Source:
-
changegrade(rank)
-
Shifts current upgrade rank up or down based on current vs passed.
Parameters:Name Type Description rank
Number rank to upgrade to. - Inherited From:
- Source:
-
channel()
-
Channels ability. Step 2 of channel process.
- Inherited From:
- Source:
-
channelStop()
-
Stops channelling ability.
- Inherited From:
- Source:
-
channelTry(args)
-
Trys to channel ability by doing checks. Step 1 of channel process.
Parameters:Name Type Argument Description args
Array <optional>
arguments to use in channel process. - Inherited From:
- Source:
-
cleanup()
-
Cleans up ability by immediately and silently deactivating.
- Inherited From:
- Source:
-
cleanupPlain()
-
Cleanup without parameters.
- Inherited From:
- Source:
-
clearQueue()
-
Entirely clears the queue.
- Inherited From:
- Source:
-
clone()
-
- Source:
-
closeEnough() → {Boolean}
-
- Inherited From:
- Source:
{ Boolean } if entity is close enough to entityTarget -
cooledDown() → {Boolean}
-
Gets whether ability is finished cooling down.
- Inherited From:
- Source:
{ Boolean } whether cooled down. -
deactivate()
-
Deactivates ability and stops channelling. Tip: for best results, your custom ability should do all of its deactivate magic by overriding the ig.Ability#deactivateComplete method!
- Inherited From:
- Source:
-
deactivateComplete()
-
Finishes deactivate. Step 2 of deactivate process. Tip: for best results, your custom ability should do all of its deactivate magic by overriding the ig.Ability#deactivateComplete method! IMPORTANT: If overriding, always call this.parent() at the end of overriding method as target is dropped at the end of this method.
- Inherited From:
- Source:
-
deactivateSetup()
-
Sets up ability to deactivate. Step 1 of deactivate process. Tip: for best results, your custom ability should do all of its deactivate magic by overriding the ig.Ability#deactivateComplete method!
- Inherited From:
- Source:
-
delayLevelLoad(spawnerName, level)
-
Unload the current level and load the level when finished downloading.
Parameters:Name Type Description spawnerName
level
- Inherited From:
- Source:
-
disable()
-
Disables ability, disallowing it to ig.Ability#activate and deactivating it if activated.
- Inherited From:
- Source:
-
downgrade(rank)
-
Downgrades ability to rank, or, if no rank passed, to previous rank possible. NOTE: Be cautious when using this on abilities that upgrade with a function and not properties.
Parameters:Name Type Argument Default Description rank
Number | Boolean <optional>
this.rank-1 rank to upgrade to, where boolean true downgrades to min rank. - Inherited From:
- Source:
-
dropEntityTarget()
-
Retains or drops current entityTarget automatically.
- Inherited From:
- Source:
-
effectEnd(effect)
-
Ends an effect.
Parameters:Name Type Description effect
ig.Effect effect. - Inherited From:
- Source:
-
effectStart(effect)
-
Creates an effect.
Parameters:Name Type Description effect
ig.Effect effect. - Inherited From:
- Source:
-
enable()
-
Enables ability, allowing it to ig.Ability#activate.
- Inherited From:
- Source:
-
execute()
-
DEPRECATED: please use ig.Ability#activate instead.
- Inherited From:
- Source:
-
extractCost()
-
Makes entity pay energy cost.
- Inherited From:
- Source:
-
fail(failReason)
-
Called when ability fails assert.
Parameters:Name Type Argument Default Description failReason
String <optional>
unknown reason for failure. - Inherited From:
- Source:
-
getActivelyUsing() → {Boolean}
-
Whether ability is in active use (i.e. activated or cast or channel).
- Inherited From:
- Source:
{ Boolean } whether in use. -
getInterrupted() → {Boolean}
-
Whether ability is interrupted (currently only by movement)
- Inherited From:
- Source:
{ Boolean } whether interrupted (currently only by movement). -
getQueueLength()
-
Returns the length of the queue.
- Inherited From:
- Source:
Number -
getUsing() → {Boolean}
-
Whether ability is in use (i.e. cast or channel).
- Inherited From:
- Source:
{ Boolean } whether in use. -
hasTarget() → {Boolean}
-
- Inherited From:
- Source:
{ Boolean } if this has entityTarget. May also attempt to find target if possible. -
hasValidTarget()
-
Checks if entityTarget is a valid target, as opposed to if is targetable.
- Inherited From:
- Source:
-
imageLoadCallback()
-
Callback for a loaded image
- Inherited From:
- Source:
-
init(entity, settings)
-
Initializes ability, called upon construction.
Parameters:Name Type Argument Description entity
ig.EntityExtended entity using ability. settings
Object <optional>
settings object. - Inherited From:
- Source:
-
initProperties()
-
Initializes ability properties.
- Inherited From:
- Source:
-
initTypes()
-
Initializes melee types.
- adds ig.Ability.TYPE.SPAMMABLE to {@link ig.Ability#type}- Source:
-
initUpgrades()
-
Initializes upgrades.
- Inherited From:
- Source:
-
isEntityTargetable(entity) → {Boolean}
-
Parameters:
Name Type Description entity
ig.EntityExtended entity target. - Inherited From:
- Source:
{ Boolean } Whether entity can (or should) be targeted. -
isEntityTargetDroppable() → {Boolean}
-
- Inherited From:
- Source:
{ Boolean } Whether current entityTarget can (or should) be dropped. -
loadLevels()
-
Preload all queued levels.
- Inherited From:
- Source:
-
loadSingleLevel(levelName)
-
Preload a single level.
Parameters:Name Type Description levelName
- Inherited From:
- Source:
-
pause()
-
Pauses ability.
- Inherited From:
- Source:
-
preloadCallback(response, options) → {boolean}
-
Callback executed whenever a level was successfully downloaded.
Parameters:Name Type Description response
options
- Inherited From:
- Source:
-
queueLevel(levelName)
-
Pushes a level inside the queue.
Parameters:Name Type Description levelName
- Inherited From:
- Source:
-
setClosestEntityTarget()
-
Finds and sets closest targetable entity.
- Inherited From:
- Source:
-
setEnabled(enabled)
-
Sets enabled state ability.
Parameters:Name Type Argument Default Description enabled
Boolean <optional>
true whether enabled. - Inherited From:
- Source:
-
setEntity(entity)
-
Sets the entity that is using this ability.
Parameters:Name Type Description entity
ig.EntityExtended ability user. - Inherited From:
- Source:
-
setEntityOptions(entity)
-
Sets the entity for passing to bindings as options. Normally the entity that the ability originated with.
Parameters:Name Type Description entity
ig.EntityExtended options provider. - Inherited From:
- Source:
-
setEntityTarget(entity)
-
Sets the entity for use as a target.
Parameters:Name Type Description entity
ig.EntityExtended entity target. - Inherited From:
- Source:
-
setEntityTargetFirst(entities)
-
Sets first targetable entity from a list.
Parameters:Name Type Description entities
Array array of entities to test. - Inherited From:
- Source:
-
unblockRegen(entity)
-
Unblocks energy regeneration in entity.
Parameters:Name Type Description entity
ig.EntityExtended block regeneration in this entity. - Inherited From:
- Source:
-
unpause()
-
Unpauses ability.
- Inherited From:
- Source:
-
update()
-
Updates ability.
- Inherited From:
- Source:
-
upgrade(rank)
-
Upgrades ability to rank, or, if no rank passed, to next rank possible.
Parameters:Name Type Argument Default Description rank
Number | Boolean <optional>
this.rank+1 rank to upgrade to, where boolean true will upgrade to max rank. - Inherited From:
- Source: