Skip to main content

API

insight exposes a global insight object. The API is grouped into target management, afflictions, defences, balances, limbs, and stats.

Target management​

FunctionDescription
setTarget(player)Set the active target.
reset()Reset the active target state.
reset("all")Reset all tracked players.
currentAffs()List afflictions on the current target.
currentAffDisplay()Return afflictions with probabilities.
currentAffDisplayHTML()Return formatted affliction display.

Afflictions​

FunctionDescription
addAff({ id, player })Add an affliction.
removeAff({ id, player })Remove an affliction.
confirmAff({ id, state, player })Confirm or deny an affliction.
confirmAffs({ ids, state, player })Confirm or deny multiple affs.
randomAffs({ ids, player })Randomly apply a list of affs.
smartAffs({ ids, player, ordered })Smart or ordered aff application.
convertAff({ id, to, player })Convert one aff to another.
countAffs({ ids, player })Count how many of the list are present.
hasAff({ id, player, probability })Check if an aff is present.
hasAffs({ ids, player, probability })Check if all affs are present.
hasAnAff({ ids, player, probability })Check if any aff is present.

Defences​

FunctionDescription
addDef({ id, player })Add a defence.
removeDef({ id, player })Remove a defence.
hasDef({ id, player })Check if a defence is active.

Balances​

FunctionDescription
hasBal({ id, player })Check if a balance is available.
lostBal({ id, player })Mark a balance as used.
balRemaining({ id, player })Time remaining on a balance.

Limbs​

FunctionDescription
getLimb({ id, player })Retrieve a limb object.
hitLimb({ id, player, value })Apply limb damage.
resetLimb({ id, player })Reset limb damage.
breakLimb({ id, player })Mark limb as broken.

Stats​

FunctionDescription
getStat({ id, player })Get a stat object.
adjustHp({ id, value, player })Adjust HP values.
adjustMana({ id, value, player })Adjust mana values.
setState({ id, value, player })Set a tracked state value.

Cures​

FunctionDescription
usedCure({ id, player })Register a cure use and update state.

Helpers​

FunctionDescription
checkBlock(pattern)Check the current output block for a match.
nextLine(pattern)Check the next line for a match.
venomToAffMap venom IDs to afflictions.

Example​

insight.setTarget("enemy");
insight.addAff({ id: "asthma" });
insight.hasAff({ id: "asthma", probability: 0.5 });