Uncommon Rares
Macro APITriggers

Enemy Spotted

Chooses whether to engage, drink a potion, or avoid a spotted enemy.

Category
Combat
Runs when
An enemy appears.
Summary
Chooses whether to engage, drink a potion, or avoid a spotted enemy.
Version
1

Events

  • combat-start

Lua Example

if ctx.combat.currentLifeRatio < 0.3 and ctx.combat.hasLifeConsumable then
  return combat.drinkPotion()
end

return combat.attack("lowestLife")

ctx Fields

TriggerPathTypeLabelDescription
Enemy Spottedctx.combat.currentLifeRationumberLife ratioCurrent life divided by maximum life.
Enemy Spottedctx.combat.hasLifeConsumablebooleanHas life consumableWhether a life-restoring consumable is available.
Enemy Spottedctx.player.levelnumberPlayer levelThe player level used for this macro run.
Enemy Spottedctx.player.currencyCoppernumberCurrencyThe player currency carried in copper.
Enemy Spottedctx.player.bag.usedSlotsnumberBag usedThe number of backpack slots currently occupied.
Enemy Spottedctx.player.bag.maxSlotsnumberBag capacityThe current backpack capacity including equipped bag bonuses.
Enemy Spottedctx.player.bag.freeSlotsnumberBag freeThe number of free backpack slots remaining.
Enemy Spottedctx.player.derivedStats.maxLifenumberDerived statA derived stat value; other stat keys are available beside maxLife.
Enemy Spottedctx.player.equipment.mainHand.itemDefinitionKeystringEquipped itemAn equipped item definition key. Replace mainHand with another equipment slot as needed.
Enemy Spottedctx.player.equipment.mainHand.raritystringEquipped item rarityThe rarity of an equipped item.
Enemy Spottedctx.player.equipment.mainHand.itemLevelnumberEquipped item levelThe required level of an equipped item.
Enemy Spottedctx.player.equipment.mainHand.dropLevelnumberEquipped drop levelThe drop level used to generate an equipped item.
Enemy Spottedctx.player.equipment.mainHand.stats.maxLifenumberEquipped item statA stat contribution from an equipped item; other stat keys are available beside maxLife.
Enemy Spottedctx.player.equipment.mainHand.affixes[].keystringEquipped affixA rolled affix key on an equipped item.

Blocks

BlockCategorySummary
AttackCombatReturns attack to the active Combat Profile.
Drink PotionCombatReturns drink potion to the active Combat Profile.
AvoidCombatReturns avoid to the active Combat Profile.
ContinueFlowReturns continue to the Storyteller.
PauseFlowReturns pause to the Storyteller.