API Lua Combat Avance

49 entries — WGRetro bot reference for Dofus Retro

Full documentation
Combat — Validation sorts
-- Verifier si on peut lancer un sort
local check = bot.canCastSpell(161)
if check.ok then
    local enemy = bot.getNearestEnemy()
    if enemy and bot.canCastSpellOnCell(161, enemy.cell) == "ok" then
        bot.castSpell(161, enemy.cell)
    end
end

-- AoE optimale
local aoe = bot.getBestZoneTarget(163)
if aoe and aoe.count >= 2 then
    bot.castSpell(163, aoe.cellId)
end
Combat — Auto-play
-- Auto-play simple
bot.addSpell(161)
bot.addSpell(162)

-- Dans fightManagement :
bot.playTurn()  -- cast tous les sorts + endTurn

Combat — Validation sorts

Property / MethodTypeDescription
bot.canCastSpell(spellId){ ok, reason }Verifie si le sort peut etre lance (AP, cooldown, maxPerTurn, summon_limit). Reasons: "ok", "spell_not_found", "not_enough_ap", "cooldown", "max_per_turn", "summon_limit"
bot.canCastSpellOnCell(spellId, cellId)stringVerifie sur une cellule precise. Retourne "ok" ou la raison du refus
bot.getTargetableCells(spellId)tableCellules ciblables par le sort (portee + LdV + ligne + freeCell)
bot.getSpellZoneCells(spellId, targetCell)tableCellules affectees par la zone d'effet
bot.getEnemiesInZone(spellId, targetCell)tableEnnemis touches par la zone du sort sur cette cellule
bot.getBestZoneTarget(spellId){ cellId, count } \nil | Cellule ciblable qui touche le plus d'ennemis (AoE optimal)
bot.spellCooldown(spellId)numberTours de cooldown restants (0 = pret)
bot.spellRange(spellId){ min, max } \nil | Portee min/max du sort
bot.getSpellRange(spellId){ min, max } \nil | Alias de spellRange
bot.getFightSpell(spellId)table \nil | Donnees completes du sort
bot.getFightSpells()tableTous nos sorts avec donnees de combat completes

Combat — Pathfinding

Property / MethodTypeDescription
bot.getReachableCells()tableCellules accessibles avec nos PM actuels (BFS)
bot.getPath(fromCell, toCell)tableChemin BFS entre deux cellules ({} si inatteignable)
bot.pathLength(fromCell, toCell)numberNombre de pas du chemin BFS (0 si inatteignable)
bot.isLineOfSight(fromCell, toCell)booleanLigne de vue libre
bot.adjacentCells(cellId)table4 cellules adjacentes
bot.isCellWalkable(cellId)booleanCellule marchable sur la map
bot.isCellFree(cellId)booleanCellule marchable ET pas de combattant vivant dessus
bot.getFighterOnCell(cellId)table \nil | Combattant vivant sur la cellule
bot.getFighter(id)table \nil | Combattant par ID (string ou number)

Combat — Invocations

Property / MethodTypeDescription
bot.getSummons()tableNos invocations vivantes
bot.hasSummons()booleanAvons-nous des invocations ?
bot.summonCount()numberNombre d'invocations vivantes
bot.summonMax()numberNombre max d'invocations (1 par defaut)
bot.summon(spellId, cellId)voidLancer un sort d'invocation sur une cellule

Combat — Challenges

Property / MethodTypeDescription
bot.hasChallenges()booleanChallenges actifs ?
bot.getChallengeIds()tableIDs des challenges
bot.getChallengeCount()numberNombre de challenges
bot.isChallengeActive(id)booleanChallenge actif ?
bot.challengeName(id)stringNom du challenge
bot.getActiveChallenges()table{{ id, name, active }}

Combat — Auto-play

Property / MethodTypeDescription
bot.addSpell(spellId)voidAjouter un sort a la liste auto-play
bot.clearSpells()voidVider la liste auto-play
bot.playTurn()voidJouer tous les sorts de la liste sur l'ennemi le plus proche, puis passer le tour

Combat — Alias et utilitaires

Property / MethodTypeDescription
bot.isInFight()booleanEn combat (fonction)
bot.myCell()numberMa cellule en combat
bot.myId()stringMon ID en combat
bot.myHP()numberMes PV en combat
bot.myLifePercent()numberMes PV en % en combat
bot.ap()numberPA restants
bot.mp()numberPM restants
bot.lifePoints()numberPV actuels
bot.maxLifePoints()numberPV max
bot.lifePointsP()numberPV en %
bot.getSummonById(id)table\nil | Invocation par ID
bot.moveTowardFighter(id)voidSe rapprocher d'un combattant
bot.fightGroup(entityId)voidAttaquer un groupe par ID
bot.placeOnCell(cellId)voidAlias chooseCell
bot.ready()voidAlias fightReady

These functions are used in the WGRetro bot Lua scripts — testable with the free plan (1 bot, no time limit). Ready-to-use scripts on the marketplace.